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: https://bitbucket.org/jpe/experimental-shiboken.git https://bitbucket.org/jpe/experimental-pyside.git 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: https://bitbucket.org/jpe/experimental-pyside/commits/81f87c89af07e8129d325109b852bedf All tests that previously passed also pass with this change, at least on OS X. 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 https://bitbucket.org/jpe/experimental-shiboken/src/156b7b4f1a71f2ff8330d67993b8a8dd268886f8/libshiboken/bindingmanager.cpp?at=use-qobject-property-to-invalidate 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. Thanks, John _______________________________________________ PySide mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/pyside
