inplace opers

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5862 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2004-04-09 22:11:35 +00:00
commit eebd6234d6

View file

@ -1,6 +1,36 @@
Version 1.3.22 (in progress)
==================================
04/10/2004: mmatus (Marcelo Matus)
[python] Fix the default behaviour (seg. fault) when an
inplace operator (+=,-=,...) was wrapped, as reported by
Lucriz (lucriz@sitilandia.it), when the most common
form was used:
A& A::operator+=(int i) { ...; return *this; }
^^^^ ^^^^^^
ie, an object is returned and its contains the same 'this'
value than the input object, which is deleted after the
operation "a += b", leaving the result with no real
object, but a seg. fault.
To fix it, we needed to introduce a new feature and use an
old one:
%feature("self:disown","") A::operator+=;
%feature("new","") A::operator+=;
here, "self:disown" disable the ownership of the 'self'
or input object, and the "new" feature transfers the
ownership to the result object.
The feature/solution could also be used in other languages
that use gc and implement the inplace operators, or other
operators, in a similar way.
04/07/2004: cheetah (William Fulton)
[C#] C++ enums are no longer wrapped by integers, they are now wrapped by
C# enums. For Example, given C++: