History

Fix unhandled std::bad_weak_ptr

ksuprynowicz committed 2 years ago

Commit 9d8b8011 parent c8eb4531 file · +1 −1Browse files

Showing the changes to libraries/script-engine/src/ScriptManager.cpp (1 of 1 file). Show all

Unified · Split

libraries/script-engine/src/ScriptManager.cpp+1−1
@@ -2054,7 +2054,7 @@ void ScriptManager::loadEntityScript(const EntityItemID& entityID, const QString · 2053 unmodified lines
2054 std::weak_ptr<ScriptManager> weakRef(shared_from_this());2054 std::weak_ptr<ScriptManager> weakRef(shared_from_this());
2055 scriptCache->getScriptContents(entityScript,2055 scriptCache->getScriptContents(entityScript,
2056 [this, weakRef, entityScript, entityID](const QString& url, const QString& contents, bool isURL, bool success, const QString& status) {2056 [this, weakRef, entityScript, entityID](const QString& url, const QString& contents, bool isURL, bool success, const QString& status) {
2057 std::shared_ptr<ScriptManager> strongRef(weakRef);2057 std::shared_ptr<ScriptManager> strongRef = weakRef.lock();
2058 if (!strongRef) {2058 if (!strongRef) {
2059 qCWarning(scriptengine) << "loadEntityScript.contentAvailable -- ScriptManager was deleted during getScriptContents!!";2059 qCWarning(scriptengine) << "loadEntityScript.contentAvailable -- ScriptManager was deleted during getScriptContents!!";
2060 return;2060 return;