diff options
author | Renato Filho <renato.filho@openbossa.org> | 2011-07-19 11:30:12 -0300 |
---|---|---|
committer | Renato Filho <renato.filho@openbossa.org> | 2011-07-19 11:30:12 -0300 |
commit | b6e0977d867acdb2529f23c407343f95908662e2 (patch) | |
tree | 4a012af24dfdedea14061760ae3dde79919401c4 | |
parent | 33301b9744b51d10e17a448636aa6a552eb72671 (diff) | |
download | pyside-b6e0977d867acdb2529f23c407343f95908662e2.tar.gz pyside-b6e0977d867acdb2529f23c407343f95908662e2.tar.xz pyside-b6e0977d867acdb2529f23c407343f95908662e2.zip |
Fix memory leak on GlobalReceiver.
-rw-r--r-- | libpyside/globalreceiver.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/libpyside/globalreceiver.cpp b/libpyside/globalreceiver.cpp index 59b8b53..8990212 100644 --- a/libpyside/globalreceiver.cpp +++ b/libpyside/globalreceiver.cpp @@ -45,7 +45,7 @@ class DynamicSlotData void addRef(const QObject* o); void decRef(const QObject* o); void clear(); - bool hasRefTo(const QObject* o) const; + int hasRefTo(const QObject* o) const; int refCount() const; int id() const; PyObject* call(PyObject* args); @@ -122,11 +122,9 @@ int DynamicSlotData::id() const return m_id; } -bool DynamicSlotData::hasRefTo(const QObject *o) const +int DynamicSlotData::hasRefTo(const QObject *o) const { - if (m_refs.size()) - return m_refs.contains(o); - return false; + return m_refs.count(o); } void DynamicSlotData::clear() @@ -261,8 +259,11 @@ int GlobalReceiver::qt_metacall(QMetaObject::Call call, int id, void** args) QHash<int, DynamicSlotData*>::iterator i = copy.begin(); while(i != copy.end()) { //Remove all refs - while (i.value()->hasRefTo(arg)) + int refs = i.value()->hasRefTo(arg); + while(refs) { disconnectNotify(arg, i.key()); + refs--; + } i++; } return -1; |