[PyQt] Slots being called on deleted QObjects

Jeremy Sanders jeremy at jeremysanders.net
Sun Apr 6 19:44:23 BST 2014


Phil Thompson wrote:

> Not as a general rule - only to avoid fixing your race condition
> properly :)

Isn't it a race condition inside PyQt? If I have lots of QWidgets listening 
for a signal, surely it's not my code's fault if they still receive signals 
after they've been deleted? Ideally, the Python code shouldn't have to worry 
about the lifetime of the C++ object.

The document doesn't know anything about the widgets which are displaying 
it, so it can't disconnect them. Is there a reliable way to get the QWidgets 
to disconnect from the signal before deletion?

Thanks

Jeremy




More information about the PyQt mailing list