[PySide] Is there a reason PySideSignalInstance source isn't incref'd?
Hugo Parente Lima
hugo.lima at openbossa.org
Thu May 31 15:44:20 CEST 2012
On Wednesday, May 30, 2012 03:22:24 PM John Ehresman wrote:
> I'm getting a segfault when I run the following:
> with updated sources from git. I can work around it with
> m = w.selectionModel()
> 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
When we delete an QObject we want to have all their connections disconnected,
o = QObject()
# 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
> 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.
> PySide mailing list
> PySide at qt-project.org
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 198 bytes
Desc: This is a digitally signed message part.
More information about the PySide