From d4bc1daf19f9cecdc512af04085e413838f9a881 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 17 Oct 2021 23:56:28 +0200 Subject: [PATCH] Revert "Remove unused code in wxGTK wxAnyButton" This reverts commit 4e366b2cfb133cf6850460e04e1c75a35df8f128 as it the code removed by it is still needed and removing it results in unit test failures in wxBitmapToggleButton unit tests with both GTK 2 and 3. See https://github.com/wxWidgets/wxWidgets/pull/2548 --- src/gtk/anybutton.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gtk/anybutton.cpp b/src/gtk/anybutton.cpp index 878946c4c8..cbf60116c7 100644 --- a/src/gtk/anybutton.cpp +++ b/src/gtk/anybutton.cpp @@ -186,7 +186,10 @@ void wxAnyButton::GTKDoShowBitmap(const wxBitmap& bitmap) { wxCHECK_RET(bitmap.IsOk(), "invalid bitmap"); - GtkWidget* const image = gtk_button_get_image(GTK_BUTTON(m_widget)); + GtkWidget* image = gtk_button_get_image(GTK_BUTTON(m_widget)); + if (image == NULL) + image = gtk_bin_get_child(GTK_BIN(m_widget)); + wxCHECK_RET(WX_GTK_IS_IMAGE(image), "must have image widget"); WX_GTK_IMAGE(image)->Set(bitmap);