]> git.saurik.com Git - wxWidgets.git/blobdiff - src/ribbon/toolbar.cpp
Merge in from trunk r64802 - r68625
[wxWidgets.git] / src / ribbon / toolbar.cpp
index 475db49bf0b37602b2b26a9ae3c1ace2e3da69a7..cd4817e0a2edbcdfaa90a6727c4876922d99fb15 100644 (file)
@@ -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);
+        }
     }
 }