From acd3342fdfdd4195fdad3d4c4d248b9610f90622 Mon Sep 17 00:00:00 2001 From: Jean-Paul Mari Date: Sat, 1 Dec 2018 20:37:59 -0500 Subject: [PATCH] Fix a crash when emulator, in non-debugger mode, opens the breakpoint UIs at launch --- docs/vj_HistoryNotes.txt | 1 + src/gui/mainwin.cpp | 28 +++++++++++++++------------- src/gui/mainwin.h | 2 +- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/docs/vj_HistoryNotes.txt b/docs/vj_HistoryNotes.txt index 9c767be..29d28f7 100644 --- a/docs/vj_HistoryNotes.txt +++ b/docs/vj_HistoryNotes.txt @@ -80,6 +80,7 @@ Git commit: TBD 43) Added a cartdridge view menu -- Added a window to display my own directory and his files list 44) Debugger sources code clean-up +45) Fix a crash when emulator, in non-debugger mode, opens the breakpoint UIs at launch Release 3 (13th November 2017) ------------------------------ diff --git a/src/gui/mainwin.cpp b/src/gui/mainwin.cpp index 352d580..a941d48 100644 --- a/src/gui/mainwin.cpp +++ b/src/gui/mainwin.cpp @@ -21,6 +21,7 @@ // JPM 08/31/2018 Added the call stack window // JPM Sept./2018 Added the new Models and BIOS handler, a screenshot feature and source code files browsing // JPM Oct./2018 Added search paths in the settings, breakpoints feature, cartdridge view menu +// JPM 11/18/2018 Fix crash with non-debugger mode // // FIXED: @@ -1234,7 +1235,7 @@ void MainWin::TogglePowerState(void) WriteLog("GUI: Resetting Jaguar...\n"); JaguarReset(); - DeleteAllBreakpoints(); + DebuggerReset(); DebuggerResetWindows(); DACPauseAudioThread(false); } @@ -1294,10 +1295,10 @@ void MainWin::ToggleRunState(void) traceStepIntoAct->setDisabled(true); traceStepOverAct->setDisabled(true); restartAct->setDisabled(true); + BreakpointsWin->RefreshContents(); } cpuBrowseWin->UnholdBPM(); - BreakpointsWin->RefreshContents(); } // Pause/unpause any running/non-running threads... @@ -1479,7 +1480,7 @@ void MainWin::ToggleCDUsage(void) } -// +// Open, or display, the breakpoints list window void MainWin::ShowBreakpointsWin(void) { BreakpointsWin->show(); @@ -1487,7 +1488,7 @@ void MainWin::ShowBreakpointsWin(void) } -// +// Delete all breakpoints void MainWin::DeleteAllBreakpoints(void) { cpuBrowseWin->ResetBPM(); @@ -1496,7 +1497,7 @@ void MainWin::DeleteAllBreakpoints(void) } -// +// Disable all breakpoints void MainWin::DisableAllBreakpoints(void) { cpuBrowseWin->DisableBPM(); @@ -1505,7 +1506,7 @@ void MainWin::DisableAllBreakpoints(void) } -// +// Open, or display, the new breakpoint function window void MainWin::ShowNewFunctionBreakpointWin(void) { NewFunctionBreakpointWin->show(); @@ -2313,10 +2314,13 @@ void MainWin::AlpineRefreshWindows(void) } -// Reset soft view windows -void MainWin::ViewResetWindows(void) +// Reset soft debugger +void MainWin::DebuggerReset(void) { - CartFilesListWin->Reset(); + if (vjs.softTypeDebugger) + { + DeleteAllBreakpoints(); + } } @@ -2329,8 +2333,8 @@ void MainWin::DebuggerResetWindows(void) allWatchBrowseWin->Reset(); heapallocatorBrowseWin->Reset(); BreakpointsWin->Reset(); + CartFilesListWin->Reset(); //ResetAlpineWindows(); - ViewResetWindows(); } } @@ -2345,8 +2349,6 @@ void MainWin::ViewRefreshWindows(void) // Refresh soft debugger & alpine debug windows void MainWin::DebuggerRefreshWindows(void) { - size_t i; - if (vjs.softTypeDebugger) { FilesrcListWin->RefreshContents(); @@ -2358,7 +2360,7 @@ void MainWin::DebuggerRefreshWindows(void) CallStackBrowseWin->RefreshContents(); heapallocatorBrowseWin->RefreshContents(); BreakpointsWin->RefreshContents(); - for (i = 0; i < vjs.nbrmemory1browserwindow; i++) + for (size_t i = 0; i < vjs.nbrmemory1browserwindow; i++) { mem1BrowseWin[i]->RefreshContents(i); } diff --git a/src/gui/mainwin.h b/src/gui/mainwin.h index 4d07906..e0aa8d1 100644 --- a/src/gui/mainwin.h +++ b/src/gui/mainwin.h @@ -65,7 +65,7 @@ class MainWin: public QMainWindow void ViewRefreshWindows(void); void AlpineRefreshWindows(void); void DebuggerResetWindows(void); - void ViewResetWindows(void); + void DebuggerReset(void); protected: void closeEvent(QCloseEvent *); -- 2.20.1