diff options
author | empyrical <empyrical@users.noreply.github.com> | 2015-12-12 17:55:15 -0700 |
---|---|---|
committer | empyrical <empyrical@users.noreply.github.com> | 2015-12-12 17:55:15 -0700 |
commit | aee1a534b52dde425450cfa9a4c7816f8dd1dfd2 (patch) | |
tree | 3ff9c8894e03d82be5621b66678bbfa90fd0ca02 /libpyside | |
parent | 1309afc740802fcef8d18c4091856409b2ea5fc0 (diff) | |
parent | 665ad5245a30175b882578ef4dea2ff42b6c9f2b (diff) |
Merge commit 'refs/changes/49/94249/3' of https://codereview.qt-project.org/pyside/pyside into fix-signal-deadlocks
From this patch:
https://codereview.qt-project.org/#/c/94249/
Diffstat (limited to 'libpyside')
-rw-r--r-- | libpyside/globalreceiverv2.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/libpyside/globalreceiverv2.cpp b/libpyside/globalreceiverv2.cpp index 47fbc9f58..d7033be45 100644 --- a/libpyside/globalreceiverv2.cpp +++ b/libpyside/globalreceiverv2.cpp @@ -157,7 +157,9 @@ void DynamicSlotDataV2::onCallbackDestroyed(void *data) { DynamicSlotDataV2* self = reinterpret_cast<DynamicSlotDataV2*>(data); self->m_weakRef = 0; + Py_BEGIN_ALLOW_THREADS delete self->m_parent; + Py_END_ALLOW_THREADS } DynamicSlotDataV2::~DynamicSlotDataV2() @@ -206,7 +208,11 @@ void GlobalReceiverV2::incRef(const QObject* link) { if (link) { if (!m_refs.contains(link)) { - if (QMetaObject::connect(link, DESTROY_SIGNAL_ID, this, DESTROY_SLOT_ID)) + bool connected; + Py_BEGIN_ALLOW_THREADS + connected = QMetaObject::connect(link, DESTROY_SIGNAL_ID, this, DESTROY_SLOT_ID); + Py_END_ALLOW_THREADS + if (connected) m_refs.append(link); else Q_ASSERT(false); @@ -227,7 +233,10 @@ void GlobalReceiverV2::decRef(const QObject* link) m_refs.removeOne(link); if (link) { if (!m_refs.contains(link)) { - bool result = QMetaObject::disconnect(link, DESTROY_SIGNAL_ID, this, DESTROY_SLOT_ID); + bool result; + Py_BEGIN_ALLOW_THREADS + result = QMetaObject::disconnect(link, DESTROY_SIGNAL_ID, this, DESTROY_SLOT_ID); + Py_END_ALLOW_THREADS Q_ASSERT(result); if (!result) return; @@ -235,7 +244,9 @@ void GlobalReceiverV2::decRef(const QObject* link) } if (m_refs.size() == 0) + Py_BEGIN_ALLOW_THREADS delete this; + Py_END_ALLOW_THREADS } @@ -250,10 +261,12 @@ int GlobalReceiverV2::refCount(const QObject* link) const void GlobalReceiverV2::notify() { QSet<const QObject*> objs = QSet<const QObject*>::fromList(m_refs); + Py_BEGIN_ALLOW_THREADS foreach(const QObject* o, objs) { QMetaObject::disconnect(o, DESTROY_SIGNAL_ID, this, DESTROY_SLOT_ID); QMetaObject::connect(o, DESTROY_SIGNAL_ID, this, DESTROY_SLOT_ID); } + Py_END_ALLOW_THREADS } QByteArray GlobalReceiverV2::hash() const |