diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-03-07 12:04:47 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-03-07 12:04:47 +0100 |
commit | 4ecb10d3b1294d03578c28467c0f3759b3496e0b (patch) | |
tree | d8110a1109a0510746e9083b3272dda872dfe4a2 /common/modelresult.cpp | |
parent | 88a0c750a80e6efb207877cac73144266e62d5ff (diff) | |
download | sink-4ecb10d3b1294d03578c28467c0f3759b3496e0b.tar.gz sink-4ecb10d3b1294d03578c28467c0f3759b3496e0b.zip |
Resolved potential deadlock
When trying to reply to a mail from kube we ran into a deadlock.
The initial result callback is called from the main thread, and that can
thus directly lead to destruction of the emitter.
Diffstat (limited to 'common/modelresult.cpp')
-rw-r--r-- | common/modelresult.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/common/modelresult.cpp b/common/modelresult.cpp index f935419..904766d 100644 --- a/common/modelresult.cpp +++ b/common/modelresult.cpp | |||
@@ -296,15 +296,15 @@ void ModelResult<T, Ptr>::setEmitter(const typename Sink::ResultEmitter<Ptr>::Pt | |||
296 | emitter->onInitialResultSetComplete([this, guard](const Ptr &parent, bool fetchedAll) { | 296 | emitter->onInitialResultSetComplete([this, guard](const Ptr &parent, bool fetchedAll) { |
297 | SinkTraceCtx(mLogCtx) << "Initial result set complete. Fetched all: " << fetchedAll; | 297 | SinkTraceCtx(mLogCtx) << "Initial result set complete. Fetched all: " << fetchedAll; |
298 | Q_ASSERT(guard); | 298 | Q_ASSERT(guard); |
299 | threadBoundary.callInMainThread([=]() { | 299 | Q_ASSERT(QThread::currentThread() == this->thread()); |
300 | const qint64 parentId = parent ? qHash(*parent) : 0; | 300 | |
301 | const auto parentIndex = createIndexFromId(parentId); | 301 | const qint64 parentId = parent ? qHash(*parent) : 0; |
302 | mEntityChildrenFetchComplete.insert(parentId); | 302 | const auto parentIndex = createIndexFromId(parentId); |
303 | if (fetchedAll) { | 303 | mEntityChildrenFetchComplete.insert(parentId); |
304 | mEntityAllChildrenFetched.insert(parentId); | 304 | if (fetchedAll) { |
305 | } | 305 | mEntityAllChildrenFetched.insert(parentId); |
306 | emit dataChanged(parentIndex, parentIndex, QVector<int>() << ChildrenFetchedRole); | 306 | } |
307 | }); | 307 | emit dataChanged(parentIndex, parentIndex, QVector<int>() << ChildrenFetchedRole); |
308 | }); | 308 | }); |
309 | mEmitter = emitter; | 309 | mEmitter = emitter; |
310 | } | 310 | } |