]> git.saurik.com Git - wxWidgets.git/blobdiff - src/ribbon/toolbar.cpp
Merge in from trunk r64802 - r68625
[wxWidgets.git] / src / ribbon / toolbar.cpp
index 22679350545b0844c53d8302d82be5c6ccb09a27..cd4817e0a2edbcdfaa90a6727c4876922d99fb15 100644 (file)
     #pragma hdrstop
 #endif
 
     #pragma hdrstop
 #endif
 
-#include "wx/ribbon/toolbar.h"
-
 #if wxUSE_RIBBON
 
 #if wxUSE_RIBBON
 
+#include "wx/ribbon/toolbar.h"
 #include "wx/ribbon/art.h"
 #include "wx/ribbon/bar.h"
 #include "wx/dcbuffer.h"
 #include "wx/ribbon/art.h"
 #include "wx/ribbon/bar.h"
 #include "wx/dcbuffer.h"
@@ -597,7 +596,7 @@ void wxRibbonToolBar::OnMouseMove(wxMouseEvent& evt)
                 what = wxRIBBON_TOOLBAR_TOOL_DROPDOWN_HOVERED;
 
             new_hover->state |= what;
                 what = wxRIBBON_TOOLBAR_TOOL_DROPDOWN_HOVERED;
 
             new_hover->state |= what;
-            
+
             if(new_hover == m_active_tool)
             {
                 new_hover->state &= ~wxRIBBON_TOOLBAR_TOOL_ACTIVE_MASK;
             if(new_hover == m_active_tool)
             {
                 new_hover->state &= ~wxRIBBON_TOOLBAR_TOOL_ACTIVE_MASK;
@@ -662,9 +661,15 @@ void wxRibbonToolBar::OnMouseUp(wxMouseEvent& WXUNUSED(evt))
             notification.SetBar(this);
             ProcessEvent(notification);
         }
             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);
+        }
     }
 }
 
     }
 }