]> git.saurik.com Git - wxWidgets.git/blobdiff - src/ribbon/toolbar.cpp
Add arg default values for the Create method
[wxWidgets.git] / src / ribbon / toolbar.cpp
index 9e8839bc92113ce59c2359bac2d2e59b500eb44c..5715d6e1bc7243fbdac131dc339bd71fa0ec13d8 100644 (file)
@@ -44,7 +44,7 @@ public:
     long state;
 };
 
-WX_DEFINE_ARRAY(wxRibbonToolBarToolBase*, wxArrayRibbonToolBarToolBase);
+WX_DEFINE_ARRAY_PTR(wxRibbonToolBarToolBase*, wxArrayRibbonToolBarToolBase);
 
 class wxRibbonToolBarToolGroup
 {
@@ -596,7 +596,7 @@ void wxRibbonToolBar::OnMouseMove(wxMouseEvent& evt)
                 what = wxRIBBON_TOOLBAR_TOOL_DROPDOWN_HOVERED;
 
             new_hover->state |= what;
-            
+
             if(new_hover == m_active_tool)
             {
                 new_hover->state &= ~wxRIBBON_TOOLBAR_TOOL_ACTIVE_MASK;
@@ -661,9 +661,15 @@ void wxRibbonToolBar::OnMouseUp(wxMouseEvent& WXUNUSED(evt))
             notification.SetBar(this);
             ProcessEvent(notification);
         }
-        m_active_tool->state &= ~wxRIBBON_TOOLBAR_TOOL_ACTIVE_MASK;
-        m_active_tool = NULL;
-        Refresh(false);
+
+        // Notice that m_active_tool could have been reset by the event handler
+        // above so we need to test it again.
+        if (m_active_tool)
+        {
+            m_active_tool->state &= ~wxRIBBON_TOOLBAR_TOOL_ACTIVE_MASK;
+            m_active_tool = NULL;
+            Refresh(false);
+        }
     }
 }