[PySide] Problems with QStyle deletion

John Ehresman jpe at wingware.com
Mon Dec 10 17:03:51 CET 2012

On 11/26/12 1:49 PM, John Ehresman wrote:
> I've been looking further into this and am wondering why either the
> destroyed signal and/or QWeakPointer are not used.  Is there a reason
> why they're not used?

I think there's a way to receive notification just before a QObject
derived object is deleted and that is to set a property on the QObject
that invalidates the wrapper when it is deleted.  I've done this in a
couple of experimental repositories I've set up at:

I modified shiboken to generate conversion functions that use a new
PySide::getWrapperForQObject call to get a wrapper for a QObject derived
object and then defined it in this commit:

All tests that previously passed also pass with this change, at least on

I also added an optional debug only hook to detect failures to
invalidate wrappers before deleting objects.  This is defined in the
first part of bindingmanager.cpp -- see

I'll be submitting these changes in chunks to codereview in a few days
unless I get feedback as to why they're a bad idea or that there's a
better way to do this.  In my view, these object lifecycle problems are
critical problems; I've spent a lot of time debugging seemingly random
crashes and then carefully rewriting code so it doesn't segfault.  I
think there can be a generic solution.



More information about the PySide mailing list