Index: gailmenuitem.c
===================================================================
RCS file: /cvs/gnome/gail/gail/gailmenuitem.c,v
retrieving revision 1.47
diff -u -p -r1.47 gailmenuitem.c
--- gailmenuitem.c	4 Jun 2004 07:36:51 -0000	1.47
+++ gailmenuitem.c	22 Aug 2005 15:20:34 -0000
@@ -310,7 +310,10 @@ gail_menu_item_do_action (AtkAction *act
       if (gail_menu_item->action_idle_handler)
         return FALSE;
       else
-        gail_menu_item->action_idle_handler = g_idle_add (idle_do_action, gail_menu_item);
+        {
+	  g_object_ref (gail_menu_item);
+          gail_menu_item->action_idle_handler = g_idle_add (idle_do_action, gail_menu_item);
+	}
       return TRUE;
     }
   else
@@ -353,11 +356,17 @@ idle_do_action (gpointer data)
   menu_item->action_idle_handler = 0;
   item = GTK_ACCESSIBLE (menu_item)->widget;
   if (item == NULL)
-    /* State is defunct */
-    return FALSE;
+    {
+      /* State is defunct */
+      g_object_unref (menu_item);
+      return FALSE;
+    }
 
   if (!GTK_WIDGET_SENSITIVE (item) || !GTK_WIDGET_VISIBLE (item))
-    return FALSE;
+    {
+      g_object_unref (menu_item);
+      return FALSE;
+    }
 
   item_parent = gtk_widget_get_parent (item);
   gtk_menu_shell_select_item (GTK_MENU_SHELL (item_parent), item);
@@ -369,6 +378,9 @@ idle_do_action (gpointer data)
                          /*force_hide*/ 1); 
   if (!item_mapped)
     ensure_menus_unposted (menu_item);
+
+  g_object_unref (menu_item);
+
   return FALSE;
 }
 
