logo       

Re: Next SWIG release: msg#00165

programming.swig

Subject: Re: Next SWIG release

Luigi Ballabio writes:
> At 08:34 PM 1/26/03 -0600, David Beazley wrote:
> >Also, if there are any minor feature requests, please let us know.
>
> Now that I think of it, there is the dreaded ownership problem---i.e., the
> fact that seemingly innocent instructions such as:
>
> foo.bar = Bar()
>
> can cause every kind of trouble if the interface is:
>
> class Bar;
>
> class Foo {
> public:
> Bar* bar;
> };
>
> If I'm not mistaken, you had thought about this and started modifying the
> internal SWIG functions so that the reference count of foo.bar could be
> incremented, right? What was the status?
>

I'm pretty sure (although I'll have to double check) that the Python
module drops ownership on assignment in this example. In other words,
the member gets set, the proxy class for Bar gets destroyed, and the
underlying object persists. There is some discussion about this here:

http://www.swig.org/Doc1.3/Python.html#n30

Cheers,

Dave
_______________________________________________
Swig maillist - Swig@xxxxxxxxxxxxxxx
http://mailman.cs.uchicago.edu/mailman/listinfo/swig



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise