From 9d8b801a77fb540baa3d624987d9ae0a0e378003 Mon Sep 17 00:00:00 2001 From: ksuprynowicz Date: Tue, 18 Jun 2024 00:40:04 +0200 Subject: [PATCH] Fix unhandled std::bad_weak_ptr --- libraries/script-engine/src/ScriptManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/script-engine/src/ScriptManager.cpp b/libraries/script-engine/src/ScriptManager.cpp index f527fbb9e2..db61d7144b 100644 --- a/libraries/script-engine/src/ScriptManager.cpp +++ b/libraries/script-engine/src/ScriptManager.cpp @@ -2054,7 +2054,7 @@ void ScriptManager::loadEntityScript(const EntityItemID& entityID, const QString std::weak_ptr weakRef(shared_from_this()); scriptCache->getScriptContents(entityScript, [this, weakRef, entityScript, entityID](const QString& url, const QString& contents, bool isURL, bool success, const QString& status) { - std::shared_ptr strongRef(weakRef); + std::shared_ptr strongRef = weakRef.lock(); if (!strongRef) { qCWarning(scriptengine) << "loadEntityScript.contentAvailable -- ScriptManager was deleted during getScriptContents!!"; return;