popovermenu: Fix crash when removing child
authorKévin Commaille <zecakeh@tedomum.fr>
Tue, 25 Jan 2022 14:31:00 +0000 (15:31 +0100)
committerKévin Commaille <zecakeh@tedomum.fr>
Tue, 25 Jan 2022 14:31:00 +0000 (15:31 +0100)
gtk_menu_section_box_remove_custom was looking in the wrong place for the
stack ancestor, causing an assertion error.

gtk/gtkmenusectionbox.c

index 72ca8c8b1a7c618c409dc1be6cc5fdb1729a9079..46df8a55f4a698b9dc68710b8ec1f715d28887fe 100644 (file)
@@ -762,8 +762,11 @@ gtk_menu_section_box_remove_custom (GtkPopoverMenu *popover,
   const char *id;
   GtkWidget *slot;
 
-  stack = gtk_popover_get_child (GTK_POPOVER (popover));
+  stack = gtk_popover_menu_get_stack (popover);
   box = GTK_MENU_SECTION_BOX (gtk_stack_get_child_by_name (GTK_STACK (stack), "main"));
+  if (box == NULL)
+    return FALSE;
+
   parent = gtk_widget_get_parent (child);
 
   id = (const char *) g_object_get_data (G_OBJECT (parent), "slot-id");