From 11f6ecce6b9d9d176d584a92c8c45843474da2d0 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 22 Jun 2014 21:36:24 +0000 Subject: [PATCH] Fix crash when right clicking AUI toolbar while left button is pressed. Ignore the unrelated mouse events during the item dragging. This avoids a crash due to m_actionItem being NULL when right clicking an item while the left mouse button is kept pressed. Closes #16327. (this is a forward port of 648d9ce1fbd6d4f2241eda764f2a9679aed6b2c4 from 3.0) --- src/aui/auibar.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/aui/auibar.cpp b/src/aui/auibar.cpp index e5b9fc6e12..a602cdb0f7 100644 --- a/src/aui/auibar.cpp +++ b/src/aui/auibar.cpp @@ -2673,6 +2673,9 @@ void wxAuiToolBar::OnLeftUp(wxMouseEvent& evt) void wxAuiToolBar::OnRightDown(wxMouseEvent& evt) { + if (HasCapture()) + return; + wxRect cli_rect(wxPoint(0,0), GetClientSize()); if (m_gripperSizerItem) @@ -2709,6 +2712,9 @@ void wxAuiToolBar::OnRightDown(wxMouseEvent& evt) void wxAuiToolBar::OnRightUp(wxMouseEvent& evt) { + if (HasCapture()) + return; + wxAuiToolBarItem* hitItem; hitItem = FindToolByPosition(evt.GetX(), evt.GetY()); @@ -2739,6 +2745,9 @@ void wxAuiToolBar::OnRightUp(wxMouseEvent& evt) void wxAuiToolBar::OnMiddleDown(wxMouseEvent& evt) { + if (HasCapture()) + return; + wxRect cli_rect(wxPoint(0,0), GetClientSize()); if (m_gripperSizerItem) @@ -2778,6 +2787,9 @@ void wxAuiToolBar::OnMiddleDown(wxMouseEvent& evt) void wxAuiToolBar::OnMiddleUp(wxMouseEvent& evt) { + if (HasCapture()) + return; + wxAuiToolBarItem* hitItem; hitItem = FindToolByPosition(evt.GetX(), evt.GetY());