X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ce00f59b5b169752d2f05ce3bb1a88ddc1b38b4c..70544c1e6c2c52722a8215ed12724a75a284be08:/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); + } } }