From ca5f92da944c6f50b5e82d73d959eda4df30476e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 26 Jan 2014 14:08:23 +0000 Subject: [PATCH] Don't keep dangling pointers in other wxRibbonButtonBar members neither. This should have been part of r75710: after deleting the button, also reset any stored pointers to it. Closes #15909. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75714 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/ribbon/buttonbar.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ribbon/buttonbar.cpp b/src/ribbon/buttonbar.cpp index 0dca48d9ee..47932ec4d4 100644 --- a/src/ribbon/buttonbar.cpp +++ b/src/ribbon/buttonbar.cpp @@ -515,6 +515,10 @@ bool wxRibbonButtonBar::DeleteButton(int button_id) { m_layouts_valid = false; m_buttons.RemoveAt(i); + if (m_hovered_button && m_hovered_button->base == button) + m_hovered_button = NULL; + if (m_active_button && m_active_button->base == button) + m_active_button = NULL; delete button; Realize(); Refresh();