Skip to content

Commit 01a2136

Browse files
committed
updated for version 7.3.1289
Problem: Get GLIB warning when removing a menu item. Solution: Reference menu-id and also call gtk_container_remove(). (Ivan Krasilnikov)
1 parent e7246d8 commit 01a2136

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/gui_gtk.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,17 @@ gui_mch_menu_set_tip(vimmenu_T *menu)
613613
void
614614
gui_mch_destroy_menu(vimmenu_T *menu)
615615
{
616+
/* Don't let gtk_container_remove automatically destroy menu->id. */
617+
if (menu->id != NULL)
618+
g_object_ref(menu->id);
619+
620+
/* Workaround for a spurious gtk warning in Ubuntu: "Trying to remove
621+
* a child that doesn't believe we're it's parent."
622+
* Remove widget from gui.menubar before destroying it. */
623+
if (menu->id != NULL && gui.menubar != NULL
624+
&& gtk_widget_get_parent(menu->id) == gui.menubar)
625+
gtk_container_remove(GTK_CONTAINER(gui.menubar), menu->id);
626+
616627
# ifdef FEAT_TOOLBAR
617628
if (menu->parent != NULL && menu_is_toolbar(menu->parent->name))
618629
{
@@ -632,6 +643,8 @@ gui_mch_destroy_menu(vimmenu_T *menu)
632643
gtk_widget_destroy(menu->id);
633644
}
634645

646+
if (menu->id != NULL)
647+
g_object_unref(menu->id);
635648
menu->submenu_id = NULL;
636649
menu->id = NULL;
637650
}

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,8 @@ static char *(features[]) =
728728

729729
static int included_patches[] =
730730
{ /* Add new patch number below this line */
731+
/**/
732+
1289,
731733
/**/
732734
1288,
733735
/**/

0 commit comments

Comments
 (0)