Index: gail/gailsubmenuitem.c
===================================================================
--- gail/gailsubmenuitem.c	(revision 1228)
+++ gail/gailsubmenuitem.c	(working copy)
@@ -357,6 +357,7 @@
   GailContainer *gail_container;
   AtkPropertyValues values = { NULL };
   gint index;
+  gint list_length;
 
   g_return_val_if_fail (GTK_IS_MENU (container), 1);
 
@@ -374,10 +375,12 @@
                              "property_change::accessible-parent", &values, NULL);
 
       index = g_list_index (gail_container->children, widget);
+      list_length = g_list_length (gail_container->children);
       g_list_free (gail_container->children);
       gail_container->children = gtk_container_get_children (container);
-      g_signal_emit_by_name (atk_parent, "children_changed::remove",
-                             index, atk_child, NULL);
+      if (index >= 0 && index <= list_length)
+        g_signal_emit_by_name (atk_parent, "children_changed::remove",
+                               index, atk_child, NULL);
     }
   return 1;
 }
