diff options
Diffstat (limited to 'common/resultprovider.h')
-rw-r--r-- | common/resultprovider.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/common/resultprovider.h b/common/resultprovider.h index 7f090e9..a064ab5 100644 --- a/common/resultprovider.h +++ b/common/resultprovider.h | |||
@@ -346,8 +346,14 @@ public: | |||
346 | emitter->onRemoved([this](const DomainType &value) { | 346 | emitter->onRemoved([this](const DomainType &value) { |
347 | this->remove(value); | 347 | this->remove(value); |
348 | }); | 348 | }); |
349 | emitter->onInitialResultSetComplete([this](const DomainType &value) { | 349 | auto ptr = emitter.data(); |
350 | this->initialResultSetComplete(value); | 350 | emitter->onInitialResultSetComplete([this, ptr](const DomainType &parent) { |
351 | auto hashValue = qHash(parent); | ||
352 | mInitialResultSetInProgress.remove(hashValue, ptr); | ||
353 | //Normally a parent is only in a single resource, except the toplevel (invalid) parent | ||
354 | if (!mInitialResultSetInProgress.contains(hashValue)) { | ||
355 | this->initialResultSetComplete(parent); | ||
356 | } | ||
351 | }); | 357 | }); |
352 | emitter->onComplete([this]() { | 358 | emitter->onComplete([this]() { |
353 | this->complete(); | 359 | this->complete(); |
@@ -365,6 +371,7 @@ public: | |||
365 | this->initialResultSetComplete(parent); | 371 | this->initialResultSetComplete(parent); |
366 | } else { | 372 | } else { |
367 | for (const auto &emitter : mEmitter) { | 373 | for (const auto &emitter : mEmitter) { |
374 | mInitialResultSetInProgress.insert(qHash(parent), emitter.data()); | ||
368 | emitter->fetch(parent); | 375 | emitter->fetch(parent); |
369 | } | 376 | } |
370 | } | 377 | } |
@@ -372,6 +379,7 @@ public: | |||
372 | 379 | ||
373 | private: | 380 | private: |
374 | QList<typename ResultEmitter<DomainType>::Ptr> mEmitter; | 381 | QList<typename ResultEmitter<DomainType>::Ptr> mEmitter; |
382 | QMultiMap<qint64, ResultEmitter<DomainType>*> mInitialResultSetInProgress; | ||
375 | }; | 383 | }; |
376 | 384 | ||
377 | 385 | ||