[PyQt] Updated PyQt Release Plans

Giovanni Bajo rasky at develer.com
Thu May 1 00:49:11 BST 2008


On Wed, 2008-04-30 at 22:18 +0200, Aaron Digulla wrote:
> Phil Thompson schrieb:
> 
> >> - For everything derived from QObject, connect to the dispose signal.
> >> At this time, save a stack trace and a pointer to the Python handle
> >> associated with the QObject
> >> - When the signal is emitted, make sure that the usage count of the
> >> corresponding Python object is 0, too. If it isn't, print the saved
> >> stack trace and a new one saying that the usage count between Python
> >> and C++ is out of sync.
> >>
> >> For the installation, the debug versions of the libraries should go
> >> into special directories so I can put them in the PATH (Windows) or
> >> the LD_LIBRARY_PATH (Linux) to select them when my code behaves odd.
> > 
> > I'm not sure what that gives you. I would imagine that a QObject disappearing 
> > while there is still a Python wrapper for it is quite common and legitimate. 
> > For example, if you keep a reference to a child object and the parent gets 
> > destroyed. The problem is only when you try and use that reference - but if 
> > you do then you will get an exception anyway.
> 
> I get a core dump and on Windows, I get nothing. Even if I could get a
> core file, it wouldn't tell me where the object was created.
> 
> So maybe the trick would be to declare the Python object as "invalid" as
> soon as the dispose signal was received. After that, any call to any
> method should raise an exception.

This is exactly what PyQt (or rather SIP) does, for every Python wrapper
of a PyQt object. Whenever the QObject dies, the Python object is
flagged as invalid, and any usage of it results in a RuntimeError;
moreover, you can check for this invalid condition through
sip.isdeleted().

Thus, I'm not sure what you are speaking of.
-- 
Giovanni Bajo
Develer S.r.l.
http://www.develer.com




More information about the PyQt mailing list