[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: [PyKDE] Re: Internal Pointers again... Was: Model indexes and
From: Mike Rovner <mrovner () cadence ! com>
Date: 2006-09-20 17:59:15
Message-ID: eervhk$mp7$1 () sea ! gmane ! org
[Download RAW message or body]
Phil Thompson wrote:
>>>> unique as far as python is concerned. So when I put this into
>>>> internalPointer to retrieve later it immediately goes out of scope in
>>>> python and is invalid when I try to reference it later.
>> PyQt can return new wrapper every time but all of them pointing to the
>> same C++ object, can it?
> Not at the moment, but SIP could be changed to make this an option for
> specific classes. However, I don't see how it helps - when the C++ object
> disappears the Python object won't know and will crash when referencing
> it.
Right, that can't prevent referencing disappeared C++ object.
However as I understand OP problem, he got Python wrapper goes out of
scope while he is keeping C++ ref to it.
My (not mine actually, see boost.python return_internal_reference
policy) is to keep C++ object and keep C++ ref to this obj in client
prog. SIP will generate a new wrapper obj referencing same C++ obj, so
when wrapper goes out of scope it's destroyed but not the C++ object it
wraps.
/m
_______________________________________________
PyKDE mailing list PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic