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 987 - Disconnecting a signal that has not been connected
: Disconnecting a signal that has not been connected
Status: CLOSED FIXED
Product: PySide
Classification: Unclassified
Component: QtCore
: 1.0.5
: PC Linux
: P3 normal
Assigned To: renato filho
:
:
:
  Show dependency treegraph
 
Reported: 2011-08-26 06:56 EEST by bbreslauer
Modified: 2011-09-21 20:49 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 bbreslauer 2011-08-26 06:56:15 EEST
PSEP 100 says that the PySide and PyQt signal/slot mechanisms should be
functionally compatible, but I think I found a small functionality difference
(I wasn't able to find the PyQt 4.5 doc, but I'm pretty sure this is just a bug
and not a functionality change in PyQt).  If I try to disconnect a specific
signal/slot before it has been connected, then I get a terminal message saying 

Object::disconnect: No such slot Test::sl(int)

The PyQt docs say that an exception will be raised if the slot is not connected
to the signal or if the signal has no connections at all, so I think this
message needs to be caught and an exception raised instead.  The difference in
functionality doesn't really matter to me, since I would just catch the
exception and pass, but hiding that message would be preferable.

Here's a simple class and script that shows this disconnect message.



from PySide.QtCore import Qt, QObject, Signal

class Test(QObject):
    sig = Signal((int,))

    def __init__(self):
        QObject.__init__(self)
    def con(self):
        self.sig.connect(self.sl)
    def dis(self):
        self.sig[int].disconnect(self.sl)
    def sl(self, i):
        print i
    def call(self):
        self.sig[int].emit(123)

t = Test()
t.dis()
t.con()
t.call()
t.dis()
Comment 1 bbreslauer 2011-08-28 02:34:24 EEST
I just tested this after upgrading to 1.0.6.1, and it seems that when I call
disconnect before connecting the signal, the disconnect method returns False. 
I also no longer get the Object::Disconnect terminal message.
Comment 2 renato filho 2011-08-30 00:45:09 EEST
fixed on pyside commit:

commit e3d93bcb06885aebee693f0357a131c6880f563c
Author: Renato Filho <renato.filho@openbossa.org>
Date:   Fri Aug 26 19:11:54 2011 -0300
Comment 3 renato filho 2011-09-21 20:49:27 EEST
Release 1.0.7