[PyQt] Slots being called on deleted QObjects
Jeremy Sanders
jeremy at jeremysanders.net
Sun Apr 6 16:08:43 BST 2014
I'm still getting numerous bug reports from users where slots are called on
deleted QObjects, giving a crash. As I previously reported, changing these
to new style signals and using "@pyqtSlot" on the slot appears to prevent
these bugs, but it's very hard to find every case.
Looking through the source code of sip (siplib/qtlib.c), it says:
/*
* We used to check that any wrapped C++ object still existed and
just
* returning None if it didn't. This caused inconsistent behaviour
* when the slot was a method connected to its object's destroyed()
* signal.
*/
I assume this is the code used to call slots on QObjects? Is this the reason
why I started getting these problems a year or two ago?
If this is the problem, is it possible to make the code more intelligent and
check if the C++ object is there as long as the signal isn't destroyed()?
Thanks
Jeremy
More information about the PyQt
mailing list