History

fix script memory issue

Dante Ruiz committed 8 years ago

Commit b750a001 parent 49d9d614 files · +4 −12Browse files

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

Unified · Split

libraries/script-engine/src/RecordingScriptingInterface.cpp+4−4
@@ -59,7 +59,7 @@ void RecordingScriptingInterface::playClip(NetworkClipLoaderPointer clipLoader, · 58 unmodified lines
5959
6060 if (callback.isFunction()) {
6161 QScriptValueList args { true, url };
62− callback.call(_scriptEngine->globalObject(), args);
62+ callback.call(QScriptValue(), args);
6363 }
6464 }
6565
@@ -78,7 +78,7 @@ void RecordingScriptingInterface::loadRecording(const QString& url, QScriptValue · 12 unmodified lines
7878 auto weakClipLoader = clipLoader.toWeakRef();
7979
8080 // when clip loaded, call the callback with the URL and success boolean
81− connect(clipLoader.data(), &recording::NetworkClipLoader::clipLoaded, this,
81+ connect(clipLoader.data(), &recording::NetworkClipLoader::clipLoaded, callback.engine(),
8282 [this, weakClipLoader, url, callback]() mutable {
8383
8484 if (auto clipLoader = weakClipLoader.toStrongRef()) {
@@ -92,12 +92,12 @@ void RecordingScriptingInterface::loadRecording(const QString& url, QScriptValue · 7 unmodified lines
9292 });
9393
9494 // when clip load fails, call the callback with the URL and failure boolean
95− connect(clipLoader.data(), &recording::NetworkClipLoader::failed, this, [this, weakClipLoader, url, callback](QNetworkReply::NetworkError error) mutable {
95+ connect(clipLoader.data(), &recording::NetworkClipLoader::failed, callback.engine(), [this, weakClipLoader, url, callback](QNetworkReply::NetworkError error) mutable {
9696 qCDebug(scriptengine) << "Failed to load recording from" << url;
9797
9898 if (callback.isFunction()) {
9999 QScriptValueList args { false, url };
100− callback.call(_scriptEngine->currentContext()->thisObject(), args);
100+ callback.call(QScriptValue(), args);
101101 }
102102
103103 if (auto clipLoader = weakClipLoader.toStrongRef()) {