From bf7965a2d7b7a14a3c93a9813650ab23b7a2f47d Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Mon, 28 Sep 2020 02:33:30 +0100 Subject: [PATCH] Add null check in wxAuiToolBar event handler This also prevents the AUI_TOOLBAR_BEGIN_DRAG event from being sent if there is no active toolbar item being dragged. Closes https://github.com/wxWidgets/wxWidgets/pull/2062 --- src/aui/auibar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aui/auibar.cpp b/src/aui/auibar.cpp index b07b2ca296..72ee06218d 100644 --- a/src/aui/auibar.cpp +++ b/src/aui/auibar.cpp @@ -2839,7 +2839,7 @@ void wxAuiToolBar::OnMotion(wxMouseEvent& evt) const bool button_pressed = HasCapture(); // start a drag event - if (!m_dragging && button_pressed && + if (!m_dragging && button_pressed && m_actionItem && abs(evt.GetX() - m_actionPos.x) + abs(evt.GetY() - m_actionPos.y) > 5) { // TODO: sending this event only makes sense if there is an 'END_DRAG'