mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 06:53:01 +02:00
Merge pull request #8947 from huffman/fix/script-include-race
Fix race condition in BatchLoader
This commit is contained in:
commit
1ba5a5d5d7
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
|
// If BatchLoader is deleted before the callback is called, the subsequent "emit" call will not do
|
||||||
// anything.
|
// anything.
|
||||||
ScriptCacheSignalProxy* proxy = new ScriptCacheSignalProxy(scriptCache.data());
|
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) {
|
connect(proxy, &ScriptCacheSignalProxy::contentAvailable, this, [this](const QString& url, const QString& contents, bool isURL, bool success) {
|
||||||
if (isURL && success) {
|
if (isURL && success) {
|
||||||
|
@ -75,6 +71,11 @@ void BatchLoader::start() {
|
||||||
emit finished(_data);
|
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