Fix bug 920 - "Cannot use same slot for two signals"
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>
Renato Araújo <renato.filho@openbossa.org>
This commit is contained in:
parent
6591448440
commit
6dea41cee4
3 changed files with 30 additions and 3 deletions
|
|
@ -26,6 +26,7 @@
|
||||||
#include <QMetaMethod>
|
#include <QMetaMethod>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
|
#include <QLinkedList>
|
||||||
#include <autodecref.h>
|
#include <autodecref.h>
|
||||||
#include <gilstate.h>
|
#include <gilstate.h>
|
||||||
|
|
||||||
|
|
@ -52,7 +53,7 @@ class DynamicSlotData
|
||||||
private:
|
private:
|
||||||
int m_id;
|
int m_id;
|
||||||
PyObject* m_callback;
|
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)
|
void DynamicSlotData::addRef(const QObject *o)
|
||||||
{
|
{
|
||||||
m_refs.insert(o);
|
m_refs.append(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicSlotData::decRef(const QObject *o)
|
void DynamicSlotData::decRef(const QObject *o)
|
||||||
{
|
{
|
||||||
m_refs.remove(o);
|
m_refs.removeOne(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
int DynamicSlotData::refCount() const
|
int DynamicSlotData::refCount() const
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ PYSIDE_TEST(bug_820.py)
|
||||||
PYSIDE_TEST(bug_826.py)
|
PYSIDE_TEST(bug_826.py)
|
||||||
PYSIDE_TEST(bug_829.py)
|
PYSIDE_TEST(bug_829.py)
|
||||||
PYSIDE_TEST(bug_835.py)
|
PYSIDE_TEST(bug_835.py)
|
||||||
|
PYSIDE_TEST(bug_920.py)
|
||||||
PYSIDE_TEST(bug_927.py)
|
PYSIDE_TEST(bug_927.py)
|
||||||
PYSIDE_TEST(blocking_signals_test.py)
|
PYSIDE_TEST(blocking_signals_test.py)
|
||||||
PYSIDE_TEST(classinfo_test.py)
|
PYSIDE_TEST(classinfo_test.py)
|
||||||
|
|
|
||||||
25
tests/QtCore/bug_920.py
Normal file
25
tests/QtCore/bug_920.py
Normal file
|
|
@ -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()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue