History

fix implicit this

RTUnreal committed 1 year ago

Commit 86c5f2c1 parent 611faa942 files · +134 −135Browse files

Showing the changes to libraries/script-engine/src/AssetScriptingInterface.cpp (1 of 42 files). Show all

Unified · Split

libraries/script-engine/src/AssetScriptingInterface.cpp+8−8
@@ -76,7 +76,7 @@ void AssetScriptingInterface::uploadData(QString data, const ScriptValue& callba · 75 unmodified lines
7676 Promise deferred = makePromise(__FUNCTION__);
7777 Q_ASSERT(engine());
7878 auto scriptEngine = engine();
79− deferred->ready([=](QString error, QVariantMap result) {
79+ deferred->ready([=, this](QString error, QVariantMap result) {
8080 auto url = result.value("url").toString();
8181 auto hash = result.value("hash").toString();
8282 jsCallback(handler, scriptEngine->newValue(url), scriptEngine->newValue(hash));
@@ -100,7 +100,7 @@ void AssetScriptingInterface::setMapping(QString path, QString hash, const Scrip · 17 unmodified lines
100100 Promise deferred = makePromise(__FUNCTION__);
101101 Q_ASSERT(engine());
102102 auto scriptEngine = engine();
103− deferred->ready([=](QString error, QVariantMap result) {
103+ deferred->ready([=, this](QString error, QVariantMap result) {
104104 jsCallback(handler, scriptEngine->newValue(error), result);
105105 });
106106
@@ -138,7 +138,7 @@ void AssetScriptingInterface::downloadData(QString urlString, const ScriptValue& · 31 unmodified lines
138138 Promise deferred = makePromise(__FUNCTION__);
139139 Q_ASSERT(engine());
140140 auto scriptEngine = engine();
141− deferred->ready([=](QString error, QVariantMap result) {
141+ deferred->ready([=, this](QString error, QVariantMap result) {
142142 // FIXME: to remain backwards-compatible the signature here is "callback(data, n/a)"
143143 jsCallback(handler, scriptEngine->newValue(result.value("data").toString()), { { "errorMessage", error } });
144144 });
@@ -202,7 +202,7 @@ void AssetScriptingInterface::getMapping(QString asset, const ScriptValue& callb · 57 unmodified lines
202202 Promise promise = getAssetInfo(path);
203203 Q_ASSERT(engine());
204204 auto scriptEngine = engine();
205− promise->ready([=](QString error, QVariantMap result) {
205+ promise->ready([=, this](QString error, QVariantMap result) {
206206 jsCallback(handler, scriptEngine->newValue(error), scriptEngine->newValue(result.value("hash").toString()));
207207 });
208208 }
@@ -317,7 +317,7 @@ void AssetScriptingInterface::getAsset(const ScriptValue& options, const ScriptV · 108 unmodified lines
317317
318318 Promise mapped = makePromise("mapped");
319319 mapped->fail(fetched);
320− mapped->then([=](QVariantMap result) {
320+ mapped->then([=, this](QVariantMap result) {
321321 QString hash = result.value("hash").toString();
322322 QString url = result.value("url").toString();
323323 if (!AssetUtils::isValidHash(hash)) {
@@ -397,7 +397,7 @@ void AssetScriptingInterface::decompressData(const ScriptValue& options, const S · 73 unmodified lines
397397 if (responseType == "arraybuffer") {
398398 decompressed->ready(completed);
399399 } else {
400− decompressed->ready([=](QString error, QVariantMap result) {
400+ decompressed->ready([=, this](QString error, QVariantMap result) {
401401 Promise converted = convertBytes(result.value("data").toByteArray(), responseType);
402402 converted->mixin(result);
403403 converted->ready(completed);
@@ -482,7 +482,7 @@ void AssetScriptingInterface::putAsset(const ScriptValue& options, const ScriptV · 78 unmodified lines
482482 }
483483
484484 prepared->fail(completed);
485− prepared->then([=](QVariantMap result) {
485+ prepared->then([=, this](QVariantMap result) {
486486 Promise upload = uploadBytes(result.value("data").toByteArray());
487487 upload->mixin(result);
488488 upload->ready(uploaded);
@@ -492,7 +492,7 @@ void AssetScriptingInterface::putAsset(const ScriptValue& options, const ScriptV · 3 unmodified lines
492492 if (path.isEmpty()) {
493493 uploaded->then(completed);
494494 } else {
495− uploaded->then([=](QVariantMap result) {
495+ uploaded->then([=, this](QVariantMap result) {
496496 QString hash = result.value("hash").toString();
497497 if (!AssetUtils::isValidHash(hash)) {
498498 completed->reject("path mapping requested, but did not receive valid hash", result);