From 404f0f8587d5bf9f5c2e9573eb07e85e5f28f866 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 1 Apr 2017 16:07:43 +0200 Subject: [PATCH] Hide wxChoice before destroying it with GTK+ 3 This works around GTK+ critical error messages that we get otherwise with GTK+ since the change done in its commit 7401794de6b084fea469af297b7c144724b8492c which appeared in 3.22.8 release and is still present in the latest version. These messages happen because gtk_combo_box_popdown() ends up being called during the widget destruction if it's still shown, so just hide the combobox before destroying it to avoid them. Closes https://github.com/wxWidgets/wxWidgets/pull/449 --- src/gtk/choice.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/gtk/choice.cpp b/src/gtk/choice.cpp index de01dfaed1..bcdce040bc 100644 --- a/src/gtk/choice.cpp +++ b/src/gtk/choice.cpp @@ -99,6 +99,15 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id, wxChoice::~wxChoice() { delete m_strings; + + #ifdef __WXGTK3__ + // At least with GTK+ 3.22.9, destroying a shown combobox widget results in + // a Gtk-CRITICAL debug message when the assertion fails inside a signal + // handler called from gtk_widget_unrealize(), which is annoying, so avoid + // it by hiding the widget before destroying it -- this doesn't look right, + // but shouldn't do any harm neither. + Hide(); + #endif // __WXGTK3__ } void wxChoice::GTKInsertComboBoxTextItem( unsigned int n, const wxString& text )