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
59 59
60 if (callback.isFunction()) {60 if (callback.isFunction()) {
61 QScriptValueList args { true, url };61 QScriptValueList args { true, url };
62 callback.call(_scriptEngine->globalObject(), args);62 callback.call(QScriptValue(), args);
63 }63 }
64}64}
65 65
@@ -78,7 +78,7 @@ void RecordingScriptingInterface::loadRecording(const QString& url, QScriptValue · 12 unmodified lines
78 auto weakClipLoader = clipLoader.toWeakRef();78 auto weakClipLoader = clipLoader.toWeakRef();
79 79
80 // when clip loaded, call the callback with the URL and success boolean80 // 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(),
82 [this, weakClipLoader, url, callback]() mutable {82 [this, weakClipLoader, url, callback]() mutable {
83 83
84 if (auto clipLoader = weakClipLoader.toStrongRef()) {84 if (auto clipLoader = weakClipLoader.toStrongRef()) {
@@ -92,12 +92,12 @@ void RecordingScriptingInterface::loadRecording(const QString& url, QScriptValue · 7 unmodified lines
92 });92 });
93 93
94 // when clip load fails, call the callback with the URL and failure boolean94 // 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 {
96 qCDebug(scriptengine) << "Failed to load recording from" << url;96 qCDebug(scriptengine) << "Failed to load recording from" << url;
97 97
98 if (callback.isFunction()) {98 if (callback.isFunction()) {
99 QScriptValueList args { false, url };99 QScriptValueList args { false, url };
100 callback.call(_scriptEngine->currentContext()->thisObject(), args);100 callback.call(QScriptValue(), args);
101 }101 }
102 102
103 if (auto clipLoader = weakClipLoader.toStrongRef()) {103 if (auto clipLoader = weakClipLoader.toStrongRef()) {