On Wednesday, May 30, 2012 03:22:24 PM John Ehresman wrote: > I'm getting a segfault when I run the following: > > w.selectionModel().selectionChanged.connect(callback) > > with updated sources from git. I can work around it with > > m = w.selectionModel() > m.selectionChanged.connect(callback) > > Stepping through the code in pysidesignal.cpp, it looks like d->source > of a PySideSignalInstance object isn't incref'd so when the temporary > ref returned by selectionModel is decref'd, the source is pointing at a > invalid object. The function that initializes a PySideSignalInstance is > instanceInitialize
When we delete an QObject we want to have all their connections disconnected, e.g. o = QObject() o.connect(...) del o # The object must be destroyed and all connections disconnected. But if the connection holds a reference to the sender this will never happen, IIRC we currently hold a weakref. With w.selectionModel() the thing is different, because the object returned is owned by C++, so when you delete m or m goes out of scope the QSelectionModel shouldn't be deleted despite of not existing a single Python object pointing to it. > Oddly this only happens in a larger program and not in a simple test > case, but I don't see how source can be assumed to be valid without > increfing it. This need further investigation, file a bug, after all, it's a bug and the program shouldn't crash there. > Thanks, > > John > _______________________________________________ > PySide mailing list > [email protected] > http://lists.qt-project.org/mailman/listinfo/pyside
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ PySide mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/pyside
