Patch #3457 2013-05-03 23:57

carjay

m_Toolbar can be still be NULL when OnUpdateUI is called
Download
3457-m_Toolbar_can.patch (2.3 KB)
Category
Application::Bugfix
Status
Accepted
Close date
2013-05-11 15:33
Assigned to
tpetrov
Index: src/src/debuggermenu.cpp
===================================================================
--- src/src/debuggermenu.cpp    (revision 9029)
+++ src/src/debuggermenu.cpp    (working copy)
@@ -861,23 +861,27 @@
         stopped = plugin->IsStopped();
         isRunning = plugin->IsRunning();
     }
-    cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor();
 
-    cbPlugin *runningPlugin = manager->GetIsRunning();
-    if (runningPlugin != NULL && runningPlugin != plugin)
-        en = false;
+    if (m_Toolbar)
+    {
+        cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor();
 
-    m_Toolbar->EnableTool(idMenuDebug, (!isRunning || stopped) && en);
-    m_Toolbar->EnableTool(idMenuRunToCursor, en && ed && stopped);
-    m_Toolbar->EnableTool(idMenuNext, isRunning && en && stopped);
-    m_Toolbar->EnableTool(idMenuNextInstr, isRunning && en && stopped);
-    m_Toolbar->EnableTool(idMenuStepIntoInstr, isRunning && en && stopped);
-    m_Toolbar->EnableTool(idMenuStep, en && stopped);
-    m_Toolbar->EnableTool(idMenuStepOut, isRunning && en && stopped);
-    m_Toolbar->EnableTool(idToolbarStop, isRunning && en);
-    m_Toolbar->EnableTool(idMenuBreak, isRunning && !stopped && en);
-    m_Toolbar->EnableTool(idDebuggerToolInfo, plugin && plugin->ToolMenuEnabled());
+        cbPlugin *runningPlugin = manager->GetIsRunning();
+        if (runningPlugin != NULL && runningPlugin != plugin)
+            en = false;
 
+        m_Toolbar->EnableTool(idMenuDebug, (!isRunning || stopped) && en);
+        m_Toolbar->EnableTool(idMenuRunToCursor, en && ed && stopped);
+        m_Toolbar->EnableTool(idMenuNext, isRunning && en && stopped);
+        m_Toolbar->EnableTool(idMenuNextInstr, isRunning && en && stopped);
+        m_Toolbar->EnableTool(idMenuStepIntoInstr, isRunning && en && stopped);
+        m_Toolbar->EnableTool(idMenuStep, en && stopped);
+        m_Toolbar->EnableTool(idMenuStepOut, isRunning && en && stopped);
+        m_Toolbar->EnableTool(idToolbarStop, isRunning && en);
+        m_Toolbar->EnableTool(idMenuBreak, isRunning && !stopped && en);
+        m_Toolbar->EnableTool(idDebuggerToolInfo, plugin && plugin->ToolMenuEnabled());
+    }
+
     // allow other UpdateUI handlers to process this event
     // *very* important! don't forget it...
     event.Skip();
carjay 2013-05-04 00:11

Issue: DebuggerToolbarHandler::OnUpdateUI does not check if m_Toolbar is NULL.

This happened to me at startup time in MainFrame::MainFrame (src/main.cpp) during the call to ScanForPlugins().

In my case the compiler settings had to be updated during this scan so a modal dialog popped up requesting confirmation. This triggered OnUpdateUI in the DebuggerToolbarHandler.

Since m_Toolbar is only created in CreateToolbars() (which is called right after ScanForPlugins()) this leads to an instant crash.

My patch simply skips the updates to m_Toolbar's members if m_Toolbar is still NULL.

tpetrov 2013-05-11 14:48

Taking this because it is debugger problem...

tpetrov 2013-05-11 15:33

In svn...