gruntime warnings in gtkmenushell - patch



Hi,

While testing my patch for #55310, I found out that menushell sometimes
gives a gruntime warning. To reproduce: testgtk->item factory, press
ALT+F, keep right arrow key pressed for a few seconds, a warning _may_
appear...

The warning was caused by doing GTK_MENU_SHELL
(parent_menu_shell->parent_menu_shell), while
parent_menu_shell->parent_menu_shell == 0x0.

Appended patch fixes this.

Ok to commit?

regards,


	Kris


Index: gtkmenushell.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkmenushell.c,v
retrieving revision 1.47
diff -u -r1.47 gtkmenushell.c
--- gtkmenushell.c	2001/09/19 21:29:57	1.47
+++ gtkmenushell.c	2001/09/22 13:16:17
@@ -959,7 +959,15 @@
 	  while (parent_menu_shell &&
 		 (GTK_MENU_SHELL_GET_CLASS (parent_menu_shell)->submenu_placement ==
 		  GTK_MENU_SHELL_GET_CLASS (menu_shell)->submenu_placement))
-	    parent_menu_shell = GTK_MENU_SHELL (parent_menu_shell->parent_menu_shell);
+	    {
+	      GtkWidget *parent_ms = NULL;
+
+	      parent_ms = parent_menu_shell->parent_menu_shell;
+	      if (parent_ms)
+		parent_menu_shell = GTK_MENU_SHELL (parent_ms);
+	      else
+		parent_menu_shell = NULL;
+	    }

 	  if (parent_menu_shell)
 	    {





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