aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-07-14 18:50:51 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:54:36 -0300
commit48a1b539a4c0ca08cda976fa1f68f4fd02f18dd5 (patch)
tree9077fa7e1edca6419b916362c79959f14f0c1aae
parent116a691516c329eb7a0dec31a134e9b58de6b9d8 (diff)
Fix bug 920 - "Cannot use same slot for two signals"
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Renato Araújo <renato.filho@openbossa.org>
-rw-r--r--libpyside/globalreceiver.cpp7
-rw-r--r--tests/QtCore/CMakeLists.txt1
-rw-r--r--tests/QtCore/bug_920.py25
3 files changed, 30 insertions, 3 deletions
diff --git a/libpyside/globalreceiver.cpp b/libpyside/globalreceiver.cpp
index 4d7bcf116..bec7b63b4 100644
--- a/libpyside/globalreceiver.cpp
+++ b/libpyside/globalreceiver.cpp
@@ -26,6 +26,7 @@
#include <QMetaMethod>
#include <QDebug>
#include <QEvent>
+#include <QLinkedList>
#include <autodecref.h>
#include <gilstate.h>
@@ -52,7 +53,7 @@ class DynamicSlotData
private:
int m_id;
PyObject* m_callback;
- QSet<const QObject*> m_refs;
+ QLinkedList<const QObject*> m_refs;
};
}
@@ -68,12 +69,12 @@ DynamicSlotData::DynamicSlotData(int id, PyObject* callback)
void DynamicSlotData::addRef(const QObject *o)
{
- m_refs.insert(o);
+ m_refs.append(o);
}
void DynamicSlotData::decRef(const QObject *o)
{
- m_refs.remove(o);
+ m_refs.removeOne(o);
}
int DynamicSlotData::refCount() const
diff --git a/tests/QtCore/CMakeLists.txt b/tests/QtCore/CMakeLists.txt
index 266c8f94b..2c99cf1b2 100644
--- a/tests/QtCore/CMakeLists.txt
+++ b/tests/QtCore/CMakeLists.txt
@@ -16,6 +16,7 @@ PYSIDE_TEST(bug_820.py)
PYSIDE_TEST(bug_826.py)
PYSIDE_TEST(bug_829.py)
PYSIDE_TEST(bug_835.py)
+PYSIDE_TEST(bug_920.py)
PYSIDE_TEST(bug_927.py)
PYSIDE_TEST(blocking_signals_test.py)
PYSIDE_TEST(classinfo_test.py)
diff --git a/tests/QtCore/bug_920.py b/tests/QtCore/bug_920.py
new file mode 100644
index 000000000..d7365b986
--- /dev/null
+++ b/tests/QtCore/bug_920.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+
+import sys
+import unittest
+import PySide.QtCore as QtCore
+
+class Signaller(QtCore.QObject):
+ s1 = QtCore.Signal()
+ s2 = QtCore.Signal()
+
+class TestBug920(unittest.TestCase):
+
+ def testIt(self):
+ s = Signaller()
+ s.s1.connect(self.onSignal)
+ s.s2.connect(self.onSignal)
+ self.assertTrue(s.s1.disconnect(self.onSignal))
+ self.assertTrue(s.s2.disconnect(self.onSignal))
+
+ def onSignal(self):
+ pass
+
+
+if __name__ == "__main__":
+ unittest.main()