Skip to content

Commit

Permalink
Qt: Fix possible crash when closing debugger
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed Feb 22, 2023
1 parent ccf9ca3 commit 4494a2c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/duckstation-qt/debuggerwindow.cpp
Expand Up @@ -390,10 +390,11 @@ void DebuggerWindow::onMemorySearchStringChanged(const QString&)

void DebuggerWindow::closeEvent(QCloseEvent* event)
{
QMainWindow::closeEvent(event);
g_emu_thread->disconnect(this);
g_emu_thread->setSystemPaused(true, true);
CPU::ClearBreakpoints();
Host::RunOnCPUThread(&CPU::ClearBreakpoints);
g_emu_thread->setSystemPaused(false);
QMainWindow::closeEvent(event);
emit closed();
}

Expand Down Expand Up @@ -421,10 +422,9 @@ void DebuggerWindow::setupAdditionalUi()

void DebuggerWindow::connectSignals()
{
EmuThread* hi = g_emu_thread;
connect(hi, &EmuThread::systemPaused, this, &DebuggerWindow::onEmulationPaused);
connect(hi, &EmuThread::systemResumed, this, &DebuggerWindow::onEmulationResumed);
connect(hi, &EmuThread::debuggerMessageReported, this, &DebuggerWindow::onDebuggerMessageReported);
connect(g_emu_thread, &EmuThread::systemPaused, this, &DebuggerWindow::onEmulationPaused);
connect(g_emu_thread, &EmuThread::systemResumed, this, &DebuggerWindow::onEmulationResumed);
connect(g_emu_thread, &EmuThread::debuggerMessageReported, this, &DebuggerWindow::onDebuggerMessageReported);

connect(m_ui.actionPause, &QAction::toggled, this, &DebuggerWindow::onPauseActionToggled);
connect(m_ui.actionRunToCursor, &QAction::triggered, this, &DebuggerWindow::onRunToCursorTriggered);
Expand Down

0 comments on commit 4494a2c

Please sign in to comment.