mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-22 13:15:39 +08:00
Ref T207, workaround for Q_ASSERT issue described in T207
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
#define BLACKMISC_DATACACHE_H
|
#define BLACKMISC_DATACACHE_H
|
||||||
|
|
||||||
#include "blackmisc/blackmiscexport.h"
|
#include "blackmisc/blackmiscexport.h"
|
||||||
|
#include "blackmisc/threadutils.h"
|
||||||
#include "blackmisc/identifier.h"
|
#include "blackmisc/identifier.h"
|
||||||
#include "blackmisc/propertyindex.h"
|
#include "blackmisc/propertyindex.h"
|
||||||
#include "blackmisc/statusmessage.h"
|
#include "blackmisc/statusmessage.h"
|
||||||
@@ -381,12 +382,18 @@ namespace BlackMisc
|
|||||||
//! If the value is currently being loaded, wait for it to finish loading, and call the notification slot, if any.
|
//! If the value is currently being loaded, wait for it to finish loading, and call the notification slot, if any.
|
||||||
void synchronize()
|
void synchronize()
|
||||||
{
|
{
|
||||||
|
// does not compile on gcc without this -> this->m_page
|
||||||
auto *queue = this->m_page->template findChild<Private::CDataPageQueue *>();
|
auto *queue = this->m_page->template findChild<Private::CDataPageQueue *>();
|
||||||
Q_ASSERT(queue);
|
Q_ASSERT(queue);
|
||||||
admit();
|
this->admit();
|
||||||
CDataCache::instance()->synchronize(this->getKey());
|
const QString key(this->getKey());
|
||||||
CDataCache::instance()->synchronize(this->getKey()); // if load was in progress when admit() was called, synchronize with the next load
|
CDataCache::instance()->synchronize(key);
|
||||||
queue->setQueuedValueFromCache(this->getKey());
|
CDataCache::instance()->synchronize(key); // if load was in progress when admit() was called, synchronize with the next load
|
||||||
|
|
||||||
|
// run in page thread
|
||||||
|
//! \todo KB 2018-01 is this OK or should it go to CValuePage::setValuesFromCache?
|
||||||
|
if (CThreadUtils::isCurrentThreadObjectThread(this->m_page)) { queue->setQueuedValueFromCache(key); }
|
||||||
|
else { QTimer::singleShot(0, queue, [ = ] { queue->setQueuedValueFromCache(key); }); }
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Data cache doesn't support setAndSave (because set() already causes save anyway).
|
//! Data cache doesn't support setAndSave (because set() already causes save anyway).
|
||||||
|
|||||||
Reference in New Issue
Block a user