summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Hergert <chergert@redhat.com>2019-10-04 12:41:23 -0700
committerChristian Hergert <chergert@redhat.com>2019-10-04 12:41:23 -0700
commitbdd7b6ec26e64abeb7f893d445e7fb2daec671c5 (patch)
treeeb94d9179d179dd68ff2773dbb7cb3e87780715f
parent94d9088034e0ad4af69d4baa2fa71127410be078 (diff)
downloadgtk+-wip/chergert/fix-critical-notebook-label.tar.gz
notebook: fix gtk_widget_unparent() with NULL childwip/chergert/fix-critical-notebook-label
When using gtk4-demo and closing the window (after changing notebook tabs), a CRITICAL like the following is presented. gtk_widget_unparent: assertion 'GTK_IS_WIDGET (widget)' failed This fixes that by conditionally checking that we have a valid widget still within the GtkBin.
-rw-r--r--gtk/gtknotebook.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 2082a1038a..2c6d03310f 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -5674,8 +5674,13 @@ static void
gtk_notebook_menu_label_unparent (GtkWidget *widget,
gpointer data)
{
- gtk_widget_unparent (gtk_bin_get_child (GTK_BIN (widget)));
- _gtk_bin_set_child (GTK_BIN (widget), NULL);
+ GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
+
+ if (child != NULL)
+ {
+ gtk_widget_unparent (child);
+ _gtk_bin_set_child (GTK_BIN (widget), NULL);
+ }
}
/* Public GtkNotebook Page Insert/Remove Methods :