[PyQt] Destructor being called on a subthread.

Kevin Watters kevinwatters at gmail.com
Thu Jul 31 15:42:17 BST 2008


I've got a sporadic crash in my app (not PyQT) and I think I have it
narrowed down.

1) Main thread creates a Flub object. 
2) Main thread releases all references to the Flub object, but there's a
cycle,
so the object isn't collected immediately.
3) Worker thread does some unrelated work, during which a garbage
collection happens.
4) This collection on the worker thread results in a deallocation for
the Flub object created in (1).
5) The Flub object's destructor cleans up structures which are not
thread safe, and an access violation occurs (sometimes).

What can I do about this?  I'm thinking about making SIP thunk all
deallocations for Flub objects back to the main thread, but I wanted to
see if PyQT has or has confronted this problem before...



More information about the PyQt mailing list