X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3c3ead1d1513a5eb79091a604f4e42b45d1bdf5d..94e0018723919fe2ca2f5b5f0a42804c16dbf3a1:/src/ribbon/toolbar.cpp diff --git a/src/ribbon/toolbar.cpp b/src/ribbon/toolbar.cpp index 945204f269..cd4817e0a2 100644 --- a/src/ribbon/toolbar.cpp +++ b/src/ribbon/toolbar.cpp @@ -15,10 +15,9 @@ #pragma hdrstop #endif -#include "wx/ribbon/toolbar.h" - #if wxUSE_RIBBON +#include "wx/ribbon/toolbar.h" #include "wx/ribbon/art.h" #include "wx/ribbon/bar.h" #include "wx/dcbuffer.h" @@ -433,6 +432,7 @@ bool wxRibbonToolBar::Realize() smallest_area = GetSizeInOrientation(size, major_axis); } } + delete[] row_sizes; // Position the groups wxSizeEvent dummy_event(GetSize()); @@ -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); + } } }