mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:24:00 +02:00
Fix race condition in BatchLoader
This commit is contained in:
parent
fe716b3641
commit
52c74f776c
1 changed files with 5 additions and 4 deletions
|
@ -56,10 +56,6 @@ void BatchLoader::start() {
|
|||
// If BatchLoader is deleted before the callback is called, the subsequent "emit" call will not do
|
||||
// anything.
|
||||
ScriptCacheSignalProxy* proxy = new ScriptCacheSignalProxy(scriptCache.data());
|
||||
scriptCache->getScriptContents(url.toString(), [proxy](const QString& url, const QString& contents, bool isURL, bool success) {
|
||||
proxy->receivedContent(url, contents, isURL, success);
|
||||
proxy->deleteLater();
|
||||
}, false);
|
||||
|
||||
connect(proxy, &ScriptCacheSignalProxy::contentAvailable, this, [this](const QString& url, const QString& contents, bool isURL, bool success) {
|
||||
if (isURL && success) {
|
||||
|
@ -75,6 +71,11 @@ void BatchLoader::start() {
|
|||
emit finished(_data);
|
||||
}
|
||||
});
|
||||
|
||||
scriptCache->getScriptContents(url.toString(), [proxy](const QString& url, const QString& contents, bool isURL, bool success) {
|
||||
proxy->receivedContent(url, contents, isURL, success);
|
||||
proxy->deleteLater();
|
||||
}, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue