X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ce00f59b5b169752d2f05ce3bb1a88ddc1b38b4c..c13d6ac1ea199d1e3908d40d129e2fd5a4d82df7:/src/ribbon/toolbar.cpp diff --git a/src/ribbon/toolbar.cpp b/src/ribbon/toolbar.cpp index 475db49bf0..cd4817e0a2 100644 --- a/src/ribbon/toolbar.cpp +++ b/src/ribbon/toolbar.cpp @@ -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); + } } }