From d32f7e3a99a0dd508ecdcfe4495451cfc5458ed2 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Wed, 31 Jul 2024 03:06:20 +1000 Subject: -debugger/qt: Fixed crash on hard reset. -ui/selmenu.cpp: Dismiss error messages on pressing left or right. --- src/frontend/mame/ui/selmenu.cpp | 20 +++++++++++++++++--- src/osd/modules/debugger/qt/mainwindow.cpp | 3 ++- src/osd/modules/debugger/qt/windowqt.cpp | 3 ++- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/frontend/mame/ui/selmenu.cpp b/src/frontend/mame/ui/selmenu.cpp index ee823f12d8e..db16681e247 100644 --- a/src/frontend/mame/ui/selmenu.cpp +++ b/src/frontend/mame/ui/selmenu.cpp @@ -1918,7 +1918,11 @@ bool menu_select_launch::handle_keys(u32 flags, int &iptkey) if (exclusive_input_pressed(iptkey, IPT_UI_CANCEL, 0)) { - if (!m_search.empty()) + if (m_ui_error) + { + // dismiss error + } + else if (!m_search.empty()) { // escape pressed with non-empty search text clears it m_search.clear(); @@ -1940,7 +1944,12 @@ bool menu_select_launch::handle_keys(u32 flags, int &iptkey) // accept left/right keys as-is with repeat if (exclusive_input_pressed(iptkey, IPT_UI_LEFT, (flags & PROCESS_LR_REPEAT) ? 6 : 0)) { - if (m_focus == focused_menu::RIGHTTOP) + if (m_ui_error) + { + // dismiss error + return false; + } + else if (m_focus == focused_menu::RIGHTTOP) { // Swap the right panel and swallow it iptkey = IPT_INVALID; @@ -1971,7 +1980,12 @@ bool menu_select_launch::handle_keys(u32 flags, int &iptkey) // swallow left/right keys if they are not appropriate if (exclusive_input_pressed(iptkey, IPT_UI_RIGHT, (flags & PROCESS_LR_REPEAT) ? 6 : 0)) { - if (m_focus == focused_menu::RIGHTTOP) + if (m_ui_error) + { + // dismiss error + return false; + } + else if (m_focus == focused_menu::RIGHTTOP) { // Swap the right panel and swallow it iptkey = IPT_INVALID; diff --git a/src/osd/modules/debugger/qt/mainwindow.cpp b/src/osd/modules/debugger/qt/mainwindow.cpp index dba5d18b9ac..ac4540bd638 100644 --- a/src/osd/modules/debugger/qt/mainwindow.cpp +++ b/src/osd/modules/debugger/qt/mainwindow.cpp @@ -463,8 +463,9 @@ void MainWindow::debugActClose() void MainWindow::debuggerExit() { + // this isn't called from a Qt event loop, so close() will leak the window object m_exiting = true; - close(); + delete this; } diff --git a/src/osd/modules/debugger/qt/windowqt.cpp b/src/osd/modules/debugger/qt/windowqt.cpp index 783c5a24393..cd0998fab86 100644 --- a/src/osd/modules/debugger/qt/windowqt.cpp +++ b/src/osd/modules/debugger/qt/windowqt.cpp @@ -251,7 +251,8 @@ void WindowQt::debugActQuit() void WindowQt::debuggerExit() { - close(); + // this isn't called from a Qt event loop, so close() will leak the window object + delete this; } -- cgit v1.2.3