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
20542054 std::weak_ptr<ScriptManager> weakRef(shared_from_this());
20552055 scriptCache->getScriptContents(entityScript,
20562056 [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();
20582058 if (!strongRef) {
20592059 qCWarning(scriptengine) << "loadEntityScript.contentAvailable -- ScriptManager was deleted during getScriptContents!!";
20602060 return;