[Nautilus-list] g_thread_init patch



A small patch to prevent views from dumping core if the thread system is
already initialized and nautilus_view_standard_main is called. The other
occurances of g_thread_init have also been changed for correctness.

Remco
diff -urN nautilus-beforepatch/components/adapter/main.c nautilus/components/adapter/main.c
--- nautilus-beforepatch/components/adapter/main.c	Thu Apr 12 23:28:04 2001
+++ nautilus/components/adapter/main.c	Fri Apr 13 00:22:30 2001
@@ -106,7 +106,10 @@
 	/* Initialize libraries. */
         gnome_init ("nautilus-adapter", VERSION, 
 		    argc, argv); 
-	g_thread_init (NULL);
+
+	if (!g_thread_supported())
+		g_thread_init (NULL);
+
 	gnome_vfs_init ();
 	bonobo_init (orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL);
 
diff -urN nautilus-beforepatch/components/hardware/main.c nautilus/components/hardware/main.c
--- nautilus-beforepatch/components/hardware/main.c	Thu Apr 12 23:28:03 2001
+++ nautilus/components/hardware/main.c	Fri Apr 13 00:21:57 2001
@@ -87,7 +87,9 @@
 	bonobo_init (orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL);
 
 	/* initialize gnome-vfs, etc */
-	g_thread_init (NULL);
+	if (!g_thread_supported())
+		g_thread_init (NULL);
+
 	gnome_vfs_init ();
 
         registration_id = oaf_make_registration_id ("OAFIID:nautilus_hardware_view_factory:8c80e55a-5c03-4403-9e51-3a5711b8a5ce", 
diff -urN nautilus-beforepatch/components/rpmview/main.c nautilus/components/rpmview/main.c
--- nautilus-beforepatch/components/rpmview/main.c	Thu Apr 12 23:28:03 2001
+++ nautilus/components/rpmview/main.c	Fri Apr 13 00:19:56 2001
@@ -85,7 +85,9 @@
 	bonobo_init (orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL);
 
 	/* initialize gnome-vfs, etc */
-	g_thread_init (NULL);
+	if (!g_thread_supported())
+		g_thread_init (NULL);
+
 	gnome_vfs_init ();
 	
         registration_id = oaf_make_registration_id ("OAFIID:nautilus_rpm_view_factory:5986d6a5-8840-44ea-84a1-e7f052bd85cf", getenv ("DISPLAY"));
diff -urN nautilus-beforepatch/components/services/summary/main.c nautilus/components/services/summary/main.c
--- nautilus-beforepatch/components/services/summary/main.c	Thu Apr 12 23:28:06 2001
+++ nautilus/components/services/summary/main.c	Fri Apr 13 00:23:17 2001
@@ -98,7 +98,10 @@
 	gdk_rgb_init ();
 
 	eel_setenv ("GNOME_VFS_HTTP_USER_AGENT", trilobite_get_useragent_string (NULL), 1);
-	g_thread_init (NULL);
+
+	if (!g_thread_supported())
+		g_thread_init (NULL);
+
 	gnome_vfs_init ();
 
 	bonobo_init (orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL);
diff -urN nautilus-beforepatch/components/throbber/main.c nautilus/components/throbber/main.c
--- nautilus-beforepatch/components/throbber/main.c	Thu Apr 12 23:28:07 2001
+++ nautilus/components/throbber/main.c	Fri Apr 13 00:23:54 2001
@@ -108,7 +108,10 @@
 	bonobo_init (orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL);
 
 	/* initialize gnome-vfs, etc */
-	g_thread_init (NULL);
+
+	if (!g_thread_supported())
+		g_thread_init (NULL);
+
 	gnome_vfs_init ();
 	nautilus_global_preferences_initialize ();   
 	
diff -urN nautilus-beforepatch/libnautilus/nautilus-view-standard-main.c nautilus/libnautilus/nautilus-view-standard-main.c
--- nautilus-beforepatch/libnautilus/nautilus-view-standard-main.c	Thu Apr 12 23:28:10 2001
+++ nautilus/libnautilus/nautilus-view-standard-main.c	Thu Apr 12 23:33:09 2001
@@ -120,7 +120,10 @@
         gnome_init (executable_name, version, 
 		    argc, argv); 
 	gdk_rgb_init ();
-	g_thread_init (NULL);
+
+	if (!g_thread_supported())
+		g_thread_init (NULL);
+
 	gnome_vfs_init ();
 	bonobo_init (orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL);
 
diff -urN nautilus-beforepatch/src/nautilus-main.c nautilus/src/nautilus-main.c
--- nautilus-beforepatch/src/nautilus-main.c	Thu Apr 12 23:27:51 2001
+++ nautilus/src/nautilus-main.c	Fri Apr 13 00:14:24 2001
@@ -229,7 +229,9 @@
 	/* Initialize the services that we use. */
 	LIBXML_TEST_VERSION
 	g_atexit (xmlCleanupParser);
-	g_thread_init (NULL);
+	
+	if (!g_thread_supported())
+		g_thread_init (NULL);
 
 	if (g_getenv ("NAUTILUS_ENABLE_TEST_COMPONENTS") != NULL) {
 		oaf_set_test_components_enabled (TRUE);
diff -urN nautilus-beforepatch/test/test-nautilus-mime-actions-set.c nautilus/test/test-nautilus-mime-actions-set.c
--- nautilus-beforepatch/test/test-nautilus-mime-actions-set.c	Thu Apr 12 23:27:56 2001
+++ nautilus/test/test-nautilus-mime-actions-set.c	Fri Apr 13 00:15:44 2001
@@ -113,7 +113,9 @@
 	gnomelib_register_popt_table (oaf_popt_options, oaf_get_popt_table_name ());
 	oaf_init (argc, argv);
 
-	g_thread_init (NULL);
+	if (!g_thread_supported())
+		g_thread_init (NULL);
+
 	gnome_vfs_init ();
 	gnome_init ("test-nautilus-mime-actions-set", "0.0",
 		    argc, argv);
diff -urN nautilus-beforepatch/test/test-nautilus-mime-actions.c nautilus/test/test-nautilus-mime-actions.c
--- nautilus-beforepatch/test/test-nautilus-mime-actions.c	Thu Apr 12 23:27:56 2001
+++ nautilus/test/test-nautilus-mime-actions.c	Fri Apr 13 00:15:26 2001
@@ -154,7 +154,9 @@
 	NautilusFile *file;
 	GList *attributes;
 
-	g_thread_init (NULL);
+	if (!g_thread_supported())
+		g_thread_init (NULL);
+
 	gnome_vfs_init ();
 
 	gnomelib_register_popt_table (oaf_popt_options, oaf_get_popt_table_name ());


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