Fix a crash when emulator, in non-debugger mode, opens the breakpoint UIs at launch
[clinton/Virtual-Jaguar-Rx.git] / src / gui / mainwin.cpp
index 352d580..a941d48 100644 (file)
@@ -21,6 +21,7 @@
 // JPM  08/31/2018  Added the call stack window\r
 // JPM  Sept./2018  Added the new Models and BIOS handler, a screenshot feature and source code files browsing\r
 // JPM   Oct./2018  Added search paths in the settings, breakpoints feature, cartdridge view menu\r
+// JPM  11/18/2018  Fix crash with non-debugger mode\r
 //\r
 \r
 // FIXED:\r
@@ -1234,7 +1235,7 @@ void MainWin::TogglePowerState(void)
 \r
                WriteLog("GUI: Resetting Jaguar...\n");\r
                JaguarReset();\r
-               DeleteAllBreakpoints();\r
+               DebuggerReset();\r
                DebuggerResetWindows();\r
                DACPauseAudioThread(false);\r
        }\r
@@ -1294,10 +1295,10 @@ void MainWin::ToggleRunState(void)
                        traceStepIntoAct->setDisabled(true);\r
                        traceStepOverAct->setDisabled(true);\r
                        restartAct->setDisabled(true);\r
+                       BreakpointsWin->RefreshContents();\r
                }\r
 \r
                cpuBrowseWin->UnholdBPM();\r
-               BreakpointsWin->RefreshContents();\r
        }\r
 \r
        // Pause/unpause any running/non-running threads...\r
@@ -1479,7 +1480,7 @@ void MainWin::ToggleCDUsage(void)
 }\r
 \r
 \r
-//\r
+// Open, or display, the breakpoints list window\r
 void MainWin::ShowBreakpointsWin(void)\r
 {\r
        BreakpointsWin->show();\r
@@ -1487,7 +1488,7 @@ void MainWin::ShowBreakpointsWin(void)
 }\r
 \r
 \r
-//\r
+// Delete all breakpoints\r
 void MainWin::DeleteAllBreakpoints(void)\r
 {\r
        cpuBrowseWin->ResetBPM();\r
@@ -1496,7 +1497,7 @@ void MainWin::DeleteAllBreakpoints(void)
 }\r
 \r
 \r
-//\r
+// Disable all breakpoints\r
 void MainWin::DisableAllBreakpoints(void)\r
 {\r
        cpuBrowseWin->DisableBPM();\r
@@ -1505,7 +1506,7 @@ void MainWin::DisableAllBreakpoints(void)
 }\r
 \r
 \r
-//\r
+// Open, or display, the new breakpoint function window\r
 void MainWin::ShowNewFunctionBreakpointWin(void)\r
 {\r
        NewFunctionBreakpointWin->show();\r
@@ -2313,10 +2314,13 @@ void MainWin::AlpineRefreshWindows(void)
 }\r
 \r
 \r
-// Reset soft view windows\r
-void MainWin::ViewResetWindows(void)\r
+// Reset soft debugger\r
+void MainWin::DebuggerReset(void)\r
 {\r
-       CartFilesListWin->Reset();\r
+       if (vjs.softTypeDebugger)\r
+       {\r
+               DeleteAllBreakpoints();\r
+       }\r
 }\r
 \r
 \r
@@ -2329,8 +2333,8 @@ void MainWin::DebuggerResetWindows(void)
                allWatchBrowseWin->Reset();\r
                heapallocatorBrowseWin->Reset();\r
                BreakpointsWin->Reset();\r
+               CartFilesListWin->Reset();\r
                //ResetAlpineWindows();\r
-               ViewResetWindows();\r
        }\r
 }\r
 \r
@@ -2345,8 +2349,6 @@ void MainWin::ViewRefreshWindows(void)
 // Refresh soft debugger & alpine debug windows\r
 void MainWin::DebuggerRefreshWindows(void)\r
 {\r
-       size_t i;\r
-\r
        if (vjs.softTypeDebugger)\r
        {\r
                FilesrcListWin->RefreshContents();\r
@@ -2358,7 +2360,7 @@ void MainWin::DebuggerRefreshWindows(void)
                CallStackBrowseWin->RefreshContents();\r
                heapallocatorBrowseWin->RefreshContents();\r
                BreakpointsWin->RefreshContents();\r
-               for (i = 0; i < vjs.nbrmemory1browserwindow; i++)\r
+               for (size_t i = 0; i < vjs.nbrmemory1browserwindow; i++)\r
                {\r
                        mem1BrowseWin[i]->RefreshContents(i);\r
                }\r