IMPORTANT: a big problem with gnome 2



so i discovered why bug-buddy 2.1 (and the panel) have random gdk thread
deadlocks.

it's because threads are being initialized (by libgnome and gnome-vfs)
before gtk_init(), even though we don't call gtk from multiple threads
(nor are even threadsafe ourselves).

the following patch "fixes" this in a way that will be fine for probably
all users, but it is not very robust.

however, i don't really understand the gnome program stuff (does
anyone?), so there could be a better way of doing it there.  or,
gnome-vfs could do its thread initialization stuff lazily - i don't know
if this is realistic or not.

i'd like to at least get this patch in ASAP so people can test / port
things, but we really need to get a better fix in.

jacob
-- 
? gnome-init.diff
? gnome-init.patch
Index: gnome-init.c
===================================================================
RCS file: /cvs/gnome/libgnome/libgnome/gnome-init.c,v
retrieving revision 1.92
diff -u -r1.92 gnome-init.c
--- gnome-init.c	2001/09/28 15:33:43	1.92
+++ gnome-init.c	2001/10/21 18:25:33
@@ -117,9 +117,6 @@
 static void
 bonobo_activation_pre_args_parse (GnomeProgram *program, GnomeModuleInfo *mod_info)
 {
-        if (!g_thread_supported ())
-		g_thread_init (NULL);
-
 	bonobo_activation_preinit (program, mod_info);
 }
 
Index: gnome-program.c
===================================================================
RCS file: /cvs/gnome/libgnome/libgnome/gnome-program.c,v
retrieving revision 1.40
diff -u -r1.40 gnome-program.c
--- gnome-program.c	2001/10/18 00:52:40	1.40
+++ gnome-program.c	2001/10/21 18:25:34
@@ -1543,6 +1543,7 @@
 
     if (!program_initialized) {
 	const char *ctmp;
+	const GnomeModuleInfo *libgnome_module;
 
 	program_module_list = g_ptr_array_new ();
 	program_modules = g_ptr_array_new ();
@@ -1550,11 +1551,25 @@
 	/* keep array NULL terminated */
 	g_ptr_array_add (program_modules, NULL);
 
-	/* Always register libgnome. */
-	gnome_program_module_register (libgnome_module_info_get ());
-
 	/* Register the requested modules. */
 	gnome_program_module_register (module_info);
+
+	/* 
+	 * make sure libgnome is always registered.
+	 *
+	 * HOWEVER, we register after the original module so that
+	 * gnomeui can register gtk before we register gnome-vfs, so
+	 * gtk doesn't think we want to use threads with it.
+	 *
+	 * Yes, this is an incredulously gross hack.
+	 *
+	 * FIXME: find a better solution
+	 */
+	libgnome_module = libgnome_module_info_get ();
+	if (!gnome_program_module_registered (libgnome_module))
+		gnome_program_module_register (libgnome_module);
+
+	if (!gnome_program_module_registered (
 
 	/* Only load shlib modules and do all that other good
 	 * stuff when not setuid/setgid, for obvious reasons */


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