summaryrefslogtreecommitdiff
path: root/src/gui_gtk.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2013-07-03 13:04:27 +0200
committerBram Moolenaar <Bram@vim.org>2013-07-03 13:04:27 +0200
commitf9da680a0b131c3895eb61f87abf4dc9c8f6a3a1 (patch)
treedb593260180158ddc2e33a28723b50ddd6e14529 /src/gui_gtk.c
parent2951b77e5039bd4af215982422fe8c9b214c2de8 (diff)
downloadvim-git-f9da680a0b131c3895eb61f87abf4dc9c8f6a3a1.tar.gz
updated for version 7.3.1289v7.3.1289
Problem: Get GLIB warning when removing a menu item. Solution: Reference menu-id and also call gtk_container_remove(). (Ivan Krasilnikov)
Diffstat (limited to 'src/gui_gtk.c')
-rw-r--r--src/gui_gtk.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gui_gtk.c b/src/gui_gtk.c
index ba2d23d1e..48537f449 100644
--- a/src/gui_gtk.c
+++ b/src/gui_gtk.c
@@ -613,6 +613,17 @@ gui_mch_menu_set_tip(vimmenu_T *menu)
void
gui_mch_destroy_menu(vimmenu_T *menu)
{
+ /* Don't let gtk_container_remove automatically destroy menu->id. */
+ if (menu->id != NULL)
+ g_object_ref(menu->id);
+
+ /* Workaround for a spurious gtk warning in Ubuntu: "Trying to remove
+ * a child that doesn't believe we're it's parent."
+ * Remove widget from gui.menubar before destroying it. */
+ if (menu->id != NULL && gui.menubar != NULL
+ && gtk_widget_get_parent(menu->id) == gui.menubar)
+ gtk_container_remove(GTK_CONTAINER(gui.menubar), menu->id);
+
# ifdef FEAT_TOOLBAR
if (menu->parent != NULL && menu_is_toolbar(menu->parent->name))
{
@@ -632,6 +643,8 @@ gui_mch_destroy_menu(vimmenu_T *menu)
gtk_widget_destroy(menu->id);
}
+ if (menu->id != NULL)
+ g_object_unref(menu->id);
menu->submenu_id = NULL;
menu->id = NULL;
}