[PyQt] RuntimeError: underlying C/C++ object has been deleted

Demetrius Cassidy dcassidy36 at mass.rr.com
Mon Apr 27 08:20:46 BST 2009

You cannot instantiate a base class wrapped through sip with super. You need
to directly call the base class contructor via the __init__ method.

I quote "The way that super is currently implemented means that the lazy
lookup is bypassed resulting in AttributeError exceptions unless the
attribute has been previously referenced."

I don't advocate the use of super, because while it might save some typing,
you end up introducing weird bugs like these into your program. Just call
the base classes __init__ method directly instead.

See: http://docs.huihoo.com/pyqt/pyqt4.html#super-and-pyqt-classes

Alexandr N Zamaraev wrote:
> Alexandr N Zamaraev wrote:
>> Os Windows Vista Home Ru + sp1
>> g++ (GCC) 3.4.5 (mingw-vista special r3)
>> Qt 4.5 (self build)
>> sip-4.7.9 (self build)
>> PyQt-win-gpl-4.4.4.zip (self build)
> I reproduce this with
> sip-4.8-snapshot-20090424 (self build)
> PyQt-win-gpl-4.5-snapshot-20090328 (self build)
> Call Garbage Collector after the closing of the dialogue does not 
> produce any effect.
> Can anyone suggest some ideas for more accurate detection of this bug?
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt

View this message in context: http://www.nabble.com/RuntimeError%3A-underlying-C-C%2B%2B-object-has-been-deleted-tp23194199p23251277.html
Sent from the PyQt mailing list archive at Nabble.com.

More information about the PyQt mailing list