[PyQt] Guaranteed avoidance of C++ destructor call

John Lee jjl at pobox.com
Thu May 30 22:49:24 BST 2013


Hi

Is it possible to guarantee that a C++ destructor of a QObject wrapped by 
PyQt is never called?

In C++ code, I can just avoid ever deleting the QObject, by not giving it 
a QObject parent, so that Qt does not manage its lifetime.  In Python 
code, it isn't obvious to me whether Python might cause the C++ d'tor to 
be called, for example during interpreter shutdown.

The particular case I'm interested in is ~QProcess, whose destructor has 
the interesting (!) behaviour of sending the KILL signal to any child 
process that it may have started.  I want to ensure that my program 
doesn't ever call that destructor, so that the KILL signal is guaranteed 
not to be sent (or at least, that it is only called after the child 
process has terminated for other reasons).  Is that possible?

If I can't guarantee that from PyQt, can I write a simple sip wrapper that 
will achieve the same end, without copying and pasting the Qt code?


John


More information about the PyQt mailing list