If a button doesn't show any text label, simply don't do anything when
SetLabel() is called instead of replacing the image shown by the button with a
text label as the button doesn't expect this to happen and doing it breaks its
assumptions about the widgets it has and results in assert failures later.
Closes #13693.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69830
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
wxAnyButton::SetLabel(label);
wxAnyButton::SetLabel(label);
+ if ( HasFlag(wxBU_NOTEXT) )
+ {
+ // Don't try to update the label for a button not showing it, this is
+ // unnecessary and can also actually replace the image we show with the
+ // label entirely breaking the button code, see #13693.
+ return;
+ }
+
const wxString labelGTK = GTKConvertMnemonics(label);
gtk_button_set_label(GTK_BUTTON(m_widget), wxGTK_CONV(labelGTK));
const wxString labelGTK = GTKConvertMnemonics(label);
gtk_button_set_label(GTK_BUTTON(m_widget), wxGTK_CONV(labelGTK));
wxControl::SetLabel(stripped);
wxControl::SetLabel(stripped);
- GtkLabel * const label = GTKGetLabel();
- wxCHECK_MSG( label, false, "no label in this toggle button?" );
+ if ( !HasFlag(wxBU_NOTEXT) )
+ {
+ GtkLabel * const label = GTKGetLabel();
+ wxCHECK_MSG( label, false, "no label in this toggle button?" );
- GTKSetLabelWithMarkupForLabel(label, markup);
+ GTKSetLabelWithMarkupForLabel(label, markup);
+ }