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
This commit is contained in:
Vadim Zeitlin
2017-04-01 16:07:43 +02:00
parent e9ce55e000
commit 404f0f8587

View File

@@ -99,6 +99,15 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
wxChoice::~wxChoice() wxChoice::~wxChoice()
{ {
delete m_strings; 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 ) void wxChoice::GTKInsertComboBoxTextItem( unsigned int n, const wxString& text )