Karsten Hopp 824f0c
To: vim_dev@googlegroups.com
Karsten Hopp 824f0c
Subject: Patch 7.3.1289
Karsten Hopp 824f0c
Fcc: outbox
Karsten Hopp 824f0c
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 824f0c
Mime-Version: 1.0
Karsten Hopp 824f0c
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 824f0c
Content-Transfer-Encoding: 8bit
Karsten Hopp 824f0c
------------
Karsten Hopp 824f0c
Karsten Hopp 824f0c
Patch 7.3.1289
Karsten Hopp 824f0c
Problem:    Get GLIB warning when removing a menu item.
Karsten Hopp 824f0c
Solution:   Reference menu-id and also call gtk_container_remove().  (Ivan
Karsten Hopp 824f0c
	    Krasilnikov)
Karsten Hopp 824f0c
Files:	    src/gui_gtk.c
Karsten Hopp 824f0c
Karsten Hopp 824f0c
Karsten Hopp 824f0c
*** ../vim-7.3.1288/src/gui_gtk.c	2012-10-18 05:18:27.000000000 +0200
Karsten Hopp 824f0c
--- src/gui_gtk.c	2013-07-03 11:49:42.000000000 +0200
Karsten Hopp 824f0c
***************
Karsten Hopp 824f0c
*** 613,618 ****
Karsten Hopp 824f0c
--- 613,629 ----
Karsten Hopp 824f0c
      void
Karsten Hopp 824f0c
  gui_mch_destroy_menu(vimmenu_T *menu)
Karsten Hopp 824f0c
  {
Karsten Hopp 824f0c
+     /* Don't let gtk_container_remove automatically destroy menu->id. */
Karsten Hopp 824f0c
+     if (menu->id != NULL)
Karsten Hopp 824f0c
+ 	g_object_ref(menu->id);
Karsten Hopp 824f0c
+ 
Karsten Hopp 824f0c
+     /* Workaround for a spurious gtk warning in Ubuntu: "Trying to remove
Karsten Hopp 824f0c
+      * a child that doesn't believe we're it's parent."
Karsten Hopp 824f0c
+      * Remove widget from gui.menubar before destroying it. */
Karsten Hopp 824f0c
+     if (menu->id != NULL && gui.menubar != NULL
Karsten Hopp 824f0c
+ 			    && gtk_widget_get_parent(menu->id) == gui.menubar)
Karsten Hopp 824f0c
+ 	gtk_container_remove(GTK_CONTAINER(gui.menubar), menu->id);
Karsten Hopp 824f0c
+ 
Karsten Hopp 824f0c
  # ifdef FEAT_TOOLBAR
Karsten Hopp 824f0c
      if (menu->parent != NULL && menu_is_toolbar(menu->parent->name))
Karsten Hopp 824f0c
      {
Karsten Hopp 824f0c
***************
Karsten Hopp 824f0c
*** 632,637 ****
Karsten Hopp 824f0c
--- 643,650 ----
Karsten Hopp 824f0c
  	    gtk_widget_destroy(menu->id);
Karsten Hopp 824f0c
      }
Karsten Hopp 824f0c
  
Karsten Hopp 824f0c
+     if (menu->id != NULL)
Karsten Hopp 824f0c
+ 	g_object_unref(menu->id);
Karsten Hopp 824f0c
      menu->submenu_id = NULL;
Karsten Hopp 824f0c
      menu->id = NULL;
Karsten Hopp 824f0c
  }
Karsten Hopp 824f0c
*** ../vim-7.3.1288/src/version.c	2013-07-03 12:45:25.000000000 +0200
Karsten Hopp 824f0c
--- src/version.c	2013-07-03 13:03:54.000000000 +0200
Karsten Hopp 824f0c
***************
Karsten Hopp 824f0c
*** 730,731 ****
Karsten Hopp 824f0c
--- 730,733 ----
Karsten Hopp 824f0c
  {   /* Add new patch number below this line */
Karsten Hopp 824f0c
+ /**/
Karsten Hopp 824f0c
+     1289,
Karsten Hopp 824f0c
  /**/
Karsten Hopp 824f0c
Karsten Hopp 824f0c
-- 
Karsten Hopp 824f0c
   [SIR LAUNCELOT runs back up the stairs, grabs a rope
Karsten Hopp 824f0c
   of the wall and swings out over the heads of the CROWD in a
Karsten Hopp 824f0c
   swashbuckling manner towards a large window.  He stops just short
Karsten Hopp 824f0c
   of the window and is left swing pathetically back and forth.]
Karsten Hopp 824f0c
LAUNCELOT: Excuse me ... could somebody give me a push ...
Karsten Hopp 824f0c
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
Karsten Hopp 824f0c
Karsten Hopp 824f0c
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 824f0c
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 824f0c
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 824f0c
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///