From a7985c39acf250794054cee9f2501ff0261be3f6 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Sat, 28 Feb 2015 15:28:34 -0800 Subject: [PATCH] Qt: Fix crash when loading a game after stopping GDB server --- CHANGES | 1 + src/platform/qt/GDBController.cpp | 6 ++++-- src/platform/qt/GDBController.h | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 13c235b8d..ce88d9a77 100644 --- a/CHANGES +++ b/CHANGES @@ -46,6 +46,7 @@ Bugfixes: - Qt: Fix crash when starting GDB stub after closing a game - Qt: Fix patch loading while a game is running - Util: Fix sockets on Windows + - Qt: Fix crash when loading a game after stopping GDB server Misc: - GBA Audio: Change internal audio sample buffer from 32-bit to 16-bit samples - GBA Memory: Simplify memory API and use fixed bus width diff --git a/src/platform/qt/GDBController.cpp b/src/platform/qt/GDBController.cpp index a21f98578..2364393cc 100644 --- a/src/platform/qt/GDBController.cpp +++ b/src/platform/qt/GDBController.cpp @@ -43,14 +43,16 @@ void GDBController::attach() { if (m_gameController->isLoaded()) { ARMDebuggerEnter(&m_gdbStub.d, DEBUGGER_ENTER_ATTACHED, 0); } else { - connect(m_gameController, &GameController::gameStarted, [this] () { - disconnect(m_gameController); + QObject::disconnect(m_autoattach); + m_autoattach = connect(m_gameController, &GameController::gameStarted, [this] () { + QObject::disconnect(m_autoattach); ARMDebuggerEnter(&m_gdbStub.d, DEBUGGER_ENTER_ATTACHED, 0); }); } } void GDBController::detach() { + QObject::disconnect(m_autoattach); if (!isAttached()) { return; } diff --git a/src/platform/qt/GDBController.h b/src/platform/qt/GDBController.h index 771fabf3d..dc310d6f7 100644 --- a/src/platform/qt/GDBController.h +++ b/src/platform/qt/GDBController.h @@ -45,6 +45,8 @@ private: ushort m_port; Address m_bindAddress; + + QMetaObject::Connection m_autoattach; }; }