Avoid assertion failure in wxButton with bitmap and empty label, see #18898
This commit is contained in:
@@ -183,19 +183,13 @@ void wxAnyButton::GTKUpdateBitmap()
|
|||||||
|
|
||||||
void wxAnyButton::GTKDoShowBitmap(const wxBitmap& bitmap)
|
void wxAnyButton::GTKDoShowBitmap(const wxBitmap& bitmap)
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( bitmap.IsOk(), "invalid bitmap" );
|
wxCHECK_RET(bitmap.IsOk(), "invalid bitmap");
|
||||||
|
|
||||||
GtkWidget *image;
|
GtkWidget* image = gtk_button_get_image(GTK_BUTTON(m_widget));
|
||||||
if ( DontShowLabel() )
|
if (image == NULL)
|
||||||
{
|
|
||||||
image = gtk_bin_get_child(GTK_BIN(m_widget));
|
image = gtk_bin_get_child(GTK_BIN(m_widget));
|
||||||
}
|
|
||||||
else // have both label and bitmap
|
|
||||||
{
|
|
||||||
image = gtk_button_get_image(GTK_BUTTON(m_widget));
|
|
||||||
}
|
|
||||||
|
|
||||||
wxCHECK_RET( image && GTK_IS_IMAGE(image), "must have image widget" );
|
wxCHECK_RET(GTK_IS_IMAGE(image), "must have image widget");
|
||||||
|
|
||||||
gtk_image_set_from_pixbuf(GTK_IMAGE(image), bitmap.GetPixbuf());
|
gtk_image_set_from_pixbuf(GTK_IMAGE(image), bitmap.GetPixbuf());
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user