[PATCH] Segfault when changing toolbar icons



Hi,

As I don't really know bonobo much, I dunno if this problem was caused by me, or
if it was a genuine Bonobo bug.

What I was doing was trying to change the pixmap on the components toolbar
button. I was using

	bonobo_ui_handler_toolbar_item_set_pixmap (uih,
						   "/Gnomines/NewGame", 
	  					   BONOBO_UI_HANDLER_PIXMAP_XPM_DATA,
		   				   face_smile_xpm);

but it kept crashing because it was getting the NewGame button instead of the
toolbar deep in bonobo internals somewhere.
Here's a patch that fixes it, but is it necessary or am I doing something
horrendous?

iain

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/bonobo/ChangeLog,v
retrieving revision 1.385
diff -U2 -r1.385 ChangeLog
--- ChangeLog	2000/05/15 16:31:31	1.385
+++ ChangeLog	2000/05/18 00:25:25
@@ -1,2 +1,7 @@
+2000-05-18  Iain Holmes  <ih@csd.abdn.ac.uk>
+
+	* bonobo/bonobo-uih-toolbar.c (toolbar_toplevel_item_set_pixmap_internal): 
+	Get the toolbar widget instead of the button.
+
 2000-05-15  Darin Adler  <darin@eazel.com>
 
Index: bonobo/bonobo-uih-toolbar.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-uih-toolbar.c,v
retrieving revision 1.12
diff -U2 -r1.12 bonobo-uih-toolbar.c
--- bonobo/bonobo-uih-toolbar.c	2000/05/01 21:55:54	1.12
+++ bonobo/bonobo-uih-toolbar.c	2000/05/18 00:25:34
@@ -2514,4 +2514,6 @@
 	GList      *l;
 	int         i;
+	char       *name;
+	int         len;
 
 	/*
@@ -2521,5 +2523,9 @@
 		return;
 
-	toolbar = GTK_TOOLBAR (toolbar_toplevel_item_get_widget (uih, internal->item->path));
+	len = strchr (internal->item->path+1, '/') - internal->item->path;
+	name = g_strndup (internal->item->path+1, len - 1);
+
+	toolbar = GTK_TOOLBAR (toolbar_toplevel_get_widget (uih, name));
+	g_free (name);
 
 	i = 0;





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