mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:24:00 +02:00
Merge pull request #16117 from ctrlaltdavid/BUGZ-1316
BUGZ-1316: Fix crashes in Assets API
This commit is contained in:
commit
b4d0c87654
1 changed files with 7 additions and 1 deletions
|
@ -127,6 +127,9 @@ void AssetScriptingInterface::setBakingEnabled(QString path, bool enabled, QScri
|
|||
auto setBakingEnabledRequest = DependencyManager::get<AssetClient>()->createSetBakingEnabledRequest({ path }, enabled);
|
||||
|
||||
Promise deferred = jsPromiseReady(makePromise(__FUNCTION__), thisObject(), callback);
|
||||
if (!deferred) {
|
||||
return;
|
||||
}
|
||||
|
||||
connect(setBakingEnabledRequest, &SetBakingEnabledRequest::finished, setBakingEnabledRequest, [deferred](SetBakingEnabledRequest* request) {
|
||||
Q_ASSERT(QThread::currentThread() == request->thread());
|
||||
|
@ -249,8 +252,11 @@ void AssetScriptingInterface::getAsset(QScriptValue options, QScriptValue scope,
|
|||
QString("Invalid responseType: '%1' (expected: %2)").arg(responseType).arg(RESPONSE_TYPES.join(" | ")));
|
||||
|
||||
Promise fetched = jsPromiseReady(makePromise("fetched"), scope, callback);
|
||||
Promise mapped = makePromise("mapped");
|
||||
if (!fetched) {
|
||||
return;
|
||||
}
|
||||
|
||||
Promise mapped = makePromise("mapped");
|
||||
mapped->fail(fetched);
|
||||
mapped->then([=](QVariantMap result) {
|
||||
QString hash = result.value("hash").toString();
|
||||
|
|
Loading…
Reference in a new issue