From bf99c7ae9f20eba472003441540c400d57efc671 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 26 Oct 2019 17:24:46 +0200 Subject: [PATCH] Fix asserts in wxRibbonButtonBar during destruction Don't do anything when the art provider is being reset during the window destruction: this is at best useless and is actually harmful as the code ended up by requesting the DPI of the TLW parent which could already be half-destroyed. --- src/ribbon/buttonbar.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ribbon/buttonbar.cpp b/src/ribbon/buttonbar.cpp index b0976c1750..17cbd00827 100644 --- a/src/ribbon/buttonbar.cpp +++ b/src/ribbon/buttonbar.cpp @@ -686,6 +686,13 @@ void wxRibbonButtonBar::SetArtProvider(wxRibbonArtProvider* art) wxRibbonControl::SetArtProvider(art); + // There is no need to do anything else when the art provider is reset to + // null during our destruction and this actually results in problems during + // program shutdown due to trying to get DPI of the already destroyed TLW + // parent. + if (!art) + return; + wxClientDC temp_dc(this); size_t btn_count = m_buttons.Count(); size_t btn_i;