]> git.saurik.com Git - wxWidgets.git/blobdiff - src/ribbon/toolbar.cpp
Explicitly include X11/Xlib.h to fix AIX build.
[wxWidgets.git] / src / ribbon / toolbar.cpp
index 475db49bf0b37602b2b26a9ae3c1ace2e3da69a7..5715d6e1bc7243fbdac131dc339bd71fa0ec13d8 100644 (file)
@@ -44,7 +44,7 @@ public:
     long state;
 };
 
-WX_DEFINE_ARRAY(wxRibbonToolBarToolBase*, wxArrayRibbonToolBarToolBase);
+WX_DEFINE_ARRAY_PTR(wxRibbonToolBarToolBase*, wxArrayRibbonToolBarToolBase);
 
 class wxRibbonToolBarToolGroup
 {
@@ -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);
+        }
     }
 }