[PyQt] Crash on exit using QCompleter for QComboBox

Phil Thompson phil at riverbankcomputing.com
Sun Jun 1 11:03:13 BST 2014


On 01/06/2014 10:30 am, Jeremy Sanders wrote:
> I wonder whether the following is a bug in my code or in PyQt. If you
> try to use the completer for completing text, then exit, there is a
> segfault in QWidgetPrivate::deleteTLSysExtra().
> 
> This goes away if the completer is removed and deleted before the
> program exits (uncomment final two lines in main).
> 
> I assume this is some sort of ownership issue, but I've tried various
> combinations of parents and so on, to no avail. I've worked around
> this in my code by creating and removing the completer in showEvent()
> and hideEvent(), but this is rather ugly.
> 
> This is PyQt4-4.10.2 and sip-4.14.7 on Linux.

I think it's the classic situation that calling 
sip.setdestroyonexit(False) is intended to solve. However for it to be 
effective then you'll need to get rid of the main() function.

Alternatively, explicitly delete things in the right order after exec() 
returns.

Phil


More information about the PyQt mailing list