summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libpyside/pysidesignal.cpp8
-rw-r--r--tests/QtGui/CMakeLists.txt1
-rw-r--r--tests/QtGui/bug_1126.py24
3 files changed, 30 insertions, 3 deletions
diff --git a/libpyside/pysidesignal.cpp b/libpyside/pysidesignal.cpp
index 71d8c49..09cf884 100644
--- a/libpyside/pysidesignal.cpp
+++ b/libpyside/pysidesignal.cpp
@@ -465,11 +465,13 @@ PyObject* signalInstanceDisconnect(PyObject* self, PyObject* args)
PyObject* result = PyObject_CallObject(pyMethod, tupleArgs);
if (result == Py_True)
return result;
- else
- Py_DECREF(result);
+
+ Py_XDECREF(result);
}
- PyErr_Format(PyExc_RuntimeError, "Failed to disconnect signal %s.", source->d->signature);
+ if (!PyErr_Occurred())
+ PyErr_Format(PyExc_RuntimeError, "Failed to disconnect signal %s.", source->d->signature);
+
return 0;
}
diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt
index da3b4b6..f18b83c 100644
--- a/tests/QtGui/CMakeLists.txt
+++ b/tests/QtGui/CMakeLists.txt
@@ -83,6 +83,7 @@ PYSIDE_TEST(bug_1041.py)
PYSIDE_TEST(bug_1048.py)
PYSIDE_TEST(bug_1077.py)
PYSIDE_TEST(bug_1124.py)
+PYSIDE_TEST(bug_1126.py)
PYSIDE_TEST(bug_1129.py)
PYSIDE_TEST(customproxywidget_test.py)
PYSIDE_TEST(deepcopy_test.py)
diff --git a/tests/QtGui/bug_1126.py b/tests/QtGui/bug_1126.py
new file mode 100644
index 0000000..749fac0
--- /dev/null
+++ b/tests/QtGui/bug_1126.py
@@ -0,0 +1,24 @@
+''' unit test for BUG #1126 '''
+''' see http://bugs.pyside.org/show_bug.cgi?id=1126 '''
+
+from helper import UsesQApplication
+import unittest
+from PySide import QtCore, QtGui
+
+class SignalInstanceDisconnTestCase(UsesQApplication):
+ def testIt(self):
+ w = QtGui.QWidget()
+ w.deleteLater()
+
+ def cb(*args):
+ self.app.quit()
+
+ w.destroyed.connect(cb)
+ self.app.exec_()
+ try:
+ w.destroyed.disconnect(cb)
+ except RuntimeError:
+ pass
+
+if __name__ == "__main__":
+ unittest.main()