diff --git a/src/platform/qt/scripting/ScriptingController.cpp b/src/platform/qt/scripting/ScriptingController.cpp index 184f61094..f5bef6b46 100644 --- a/src/platform/qt/scripting/ScriptingController.cpp +++ b/src/platform/qt/scripting/ScriptingController.cpp @@ -77,7 +77,7 @@ void ScriptingController::setController(std::shared_ptr controll CoreController::Interrupter interrupter(m_controller); m_controller->thread()->scriptContext = &m_scriptContext; if (m_controller->hasStarted()) { - mScriptContextAttachCore(&m_scriptContext, m_controller->thread()->core); + attach(); } updateVideoScale(); connect(m_controller.get(), &CoreController::stopping, this, &ScriptingController::clearController); @@ -154,7 +154,7 @@ void ScriptingController::reset() { m_activeEngine = nullptr; init(); if (m_controller && m_controller->hasStarted()) { - mScriptContextAttachCore(&m_scriptContext, m_controller->thread()->core); + attach(); } } @@ -298,6 +298,12 @@ void ScriptingController::updateGamepad() { } } +void ScriptingController::attach() { + CoreController::Interrupter interrupter(m_controller); + mScriptContextAttachCore(&m_scriptContext, m_controller->thread()->core); + m_controller->attachDebugger(false); +} + void ScriptingController::attachGamepad() { mScriptGamepad* pad = mScriptContextGamepadLookup(&m_scriptContext, 0); if (pad == &m_gamepad) { diff --git a/src/platform/qt/scripting/ScriptingController.h b/src/platform/qt/scripting/ScriptingController.h index f2e698d76..a44e52b2e 100644 --- a/src/platform/qt/scripting/ScriptingController.h +++ b/src/platform/qt/scripting/ScriptingController.h @@ -67,6 +67,7 @@ protected: private slots: void updateGamepad(); + void attach(); private: void init();