PySide Bugzilla Closed for New Bugs

PySide is now a Qt Add-on and uses the Qt Project's JIRA Bug Tracker instead of this Bugzilla instance. This Bugzilla is left for reference purposes.

Bug 846 - QObject.destroyed signal does not include destroyed QObject
: QObject.destroyed signal does not include destroyed QObject
Status: CLOSED INVALID
Product: PySide
Classification: Unclassified
Component: QtCore
: HEAD
: PC Linux
: P2 normal
Assigned To: renato filho
:
:
:
  Show dependency treegraph
 
Reported: 2011-05-03 00:22 EEST by Nathan
Modified: 2011-06-22 20:25 EEST (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nathan 2011-05-03 00:22:40 EEST
The QObject.destroyed should include a reference to the object that is being
destroyed.  However, if that parameter is included in the receiving slot, an
exception is thrown.

Example code:

import sys
from PySide import QtCore, QtGui

class DestroyedListener(QtCore.QObject):

    @QtCore.Slot(QtCore.QObject)
    def object_destroyed(self, obj):
        print 'Object ' + str(obj) + ' was just destroyed'


app = QtGui.QApplication(sys.argv)
d = DestroyedListener()
w = QtGui.QWidget()
w.destroyed.connect(d.object_destroyed)
del w


Expected output:

  Object <PySide.QtGui.QWidget object at 0x7f7651507a58> was just destroyed

Actual output:

  Error calling slot "object_destroyed" 
  TypeError: object_destroyed() takes exactly 2 arguments (1 given)
  -------------------------------
  WrapperMap: 0x2566780 (size: 0)
  -------------------------------

This bug is present in at least versions 1.0.0 and the latest code in the
gitorious repository (May 2, 2011).  Tested on Fedora Core 13.
Comment 1 Hugo Parente Lima 2011-05-03 16:25:18 EEST
Thanks for reporting, prioritizing as P2.
Comment 2 Hugo Parente Lima 2011-05-05 22:07:08 EEST
Marking as invalid, the correct code is:

import sys
from PySide import QtCore, QtGui

class DestroyedListener(QtCore.QObject):

    @QtCore.Slot(QtCore.QObject)
    def object_destroyed(self, obj):
        print 'Object ' + str(obj) + ' was just destroyed'


app = QtGui.QApplication(sys.argv)
d = DestroyedListener()
w = QtGui.QWidget()
w.destroyed[QtCore.QObject].connect(d.object_destroyed)
del w


If you don't use the [QtCore.QObject] you are using the signal destroyed() not
the destroyed(QObject*).
Comment 3 renato filho 2011-06-22 20:25:20 EEST
release 1.0.4