[PySide] Is there a reason PySideSignalInstance source isn't incref'd?
jpe at wingware.com
Thu May 31 16:27:59 CEST 2012
On 5/31/12 9:44 AM, Hugo Parente Lima wrote:
>> 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()
> 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.
I think PySideSignalInstance is used for the usually short-lived object
created for the obj.signalname attribute. It has connect, disconnect,
and emit methods. Possibly a weakref should be used here for the case of:
obj = get_existing_object()
signal = obj.destroyed
but I don't see great harm in keeping the PyObject* that was bound to
More information about the PySide