Patch for GtkOptionMenu



This fixes the assumption that option_menu->menu is valid in the
gtk_option_menu_get_history function.  It is against the 1.3 branch.

George


Index: gtkoptionmenu.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkoptionmenu.c,v
retrieving revision 1.27
diff -u -r1.27 gtkoptionmenu.c
--- gtkoptionmenu.c	1999/12/03 20:15:32	1.27
+++ gtkoptionmenu.c	2000/01/25 22:44:24
@@ -251,13 +251,16 @@
   
   g_return_val_if_fail (GTK_IS_OPTION_MENU (option_menu), -1);
   
-  active_widget = gtk_menu_get_active (GTK_MENU (option_menu->menu));
+  if (option_menu->menu)
+    {
+      active_widget = gtk_menu_get_active (GTK_MENU (option_menu->menu));
 
-  if (active_widget)
-    return g_list_index (GTK_MENU_SHELL (option_menu->menu)->children,
-			 active_widget);
-  else
-    return -1;
+      if (active_widget)
+        return g_list_index (GTK_MENU_SHELL (option_menu->menu)->children,
+			     active_widget);
+    }
+
+  return -1;
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]