rpms/gtk2/devel init-deadlock.patch,NONE,1.1 gtk2.spec,1.317,1.318

Matthias Clasen mclasen at fedoraproject.org
Fri Sep 5 01:05:58 UTC 2008


Author: mclasen

Update of /cvs/extras/rpms/gtk2/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv5770

Modified Files:
	gtk2.spec 
Added Files:
	init-deadlock.patch 
Log Message:
fix a deadlock in pixbuf loader initialization


init-deadlock.patch:

--- NEW FILE init-deadlock.patch ---
Index: gdk-pixbuf/gdk-pixbuf-loader.c
===================================================================
--- gdk-pixbuf/gdk-pixbuf-loader.c	(revision 21294)
+++ gdk-pixbuf/gdk-pixbuf-loader.c	(working copy)
@@ -356,9 +356,8 @@
         if (priv->image_module == NULL)
                 return 0;
   
-        if (priv->image_module->module == NULL)
-                if (!_gdk_pixbuf_load_module (priv->image_module, error))
-                        return 0;
+        if (!_gdk_pixbuf_load_module (priv->image_module, error))
+                return 0;
   
         if (priv->image_module->module == NULL)
                 return 0;
Index: gdk-pixbuf/gdk-pixbuf-io.c
===================================================================
--- gdk-pixbuf/gdk-pixbuf-io.c	(revision 21294)
+++ gdk-pixbuf/gdk-pixbuf-io.c	(working copy)
@@ -292,6 +292,11 @@
 
 #endif	/* USE_GMODULE */
 
+
+static gboolean
+gdk_pixbuf_load_module_unlocked (GdkPixbufModule *image_module,
+				 GError         **error);
+
 static void 
 gdk_pixbuf_io_init (void)
 {
@@ -318,7 +323,7 @@
 #define load_one_builtin_module(format)					\
 	builtin_module = g_new0 (GdkPixbufModule, 1);			\
 	builtin_module->module_name = #format;				\
-	if (_gdk_pixbuf_load_module (builtin_module, NULL))		\
+	if (gdk_pixbuf_load_module_unlocked (builtin_module, NULL))		\
 		file_formats = g_slist_prepend (file_formats, builtin_module);\
 	else								\
 		g_free (builtin_module)
@@ -541,51 +546,7 @@
 #endif
 }
 
-#ifdef USE_GMODULE
 
-/* actually load the image handler - gdk_pixbuf_get_module only get a */
-/* reference to the module to load, it doesn't actually load it       */
-/* perhaps these actions should be combined in one function           */
-static gboolean
-_gdk_pixbuf_load_module_unlocked (GdkPixbufModule *image_module,
-				  GError         **error)
-{
-	char *path;
-	GModule *module;
-	gpointer sym;
-		
-        g_return_val_if_fail (image_module->module == NULL, FALSE);
-
-	path = image_module->module_path;
-	module = g_module_open (path, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
-
-        if (!module) {
-                g_set_error (error,
-                             GDK_PIXBUF_ERROR,
-                             GDK_PIXBUF_ERROR_FAILED,
-                             _("Unable to load image-loading module: %s: %s"),
-                             path, g_module_error ());
-                return FALSE;
-        }
-
-	image_module->module = module;        
-        
-        if (g_module_symbol (module, "fill_vtable", &sym)) {
-                GdkPixbufModuleFillVtableFunc func = (GdkPixbufModuleFillVtableFunc) sym;
-                (* func) (image_module);
-                return TRUE;
-        } else {
-                g_set_error (error,
-                             GDK_PIXBUF_ERROR,
-                             GDK_PIXBUF_ERROR_FAILED,
-                             _("Image-loading module %s does not export the proper interface; perhaps it's from a different GTK version?"),
-                             path);
-                return FALSE;
-        }
-}
-
-#endif  /* !USE_GMODULE */
-
 #define module(type) \
   extern void _gdk_pixbuf__##type##_fill_info   (GdkPixbufFormat *info);   \
   extern void _gdk_pixbuf__##type##_fill_vtable (GdkPixbufModule *module)
@@ -617,29 +578,19 @@
 
 #undef module
 
-gboolean
-_gdk_pixbuf_load_module (GdkPixbufModule *image_module,
-			 GError         **error)
+/* actually load the image handler - gdk_pixbuf_get_module only get a */
+/* reference to the module to load, it doesn't actually load it       */
+/* perhaps these actions should be combined in one function           */
+static gboolean
+gdk_pixbuf_load_module_unlocked (GdkPixbufModule *image_module,
+				 GError         **error)
 {
-	gboolean ret;
-	gboolean locked = FALSE;
 	GdkPixbufModuleFillInfoFunc fill_info = NULL;
         GdkPixbufModuleFillVtableFunc fill_vtable = NULL;
+		
+        if (image_module->module != NULL)
+               return TRUE;
 
-	/* be extra careful, maybe the module initializes
-	 * the thread system
-	 */
-	if (g_threads_got_initialized) {
-		G_LOCK (init_lock);
-		locked = TRUE;
-	}
-
-	if (image_module->module != NULL) {
-		if (locked)
-			G_UNLOCK (init_lock);
-		return TRUE;
-	}
-
 #define try_module(format,id)						\
 	if (fill_info == NULL &&					\
 	    strcmp (image_module->module_name, #format) == 0) {		\
@@ -715,22 +666,70 @@
 		image_module->info = g_new0 (GdkPixbufFormat, 1);
 		(* fill_info) (image_module->info);
 
-                ret = TRUE;
+                return TRUE;
 	}
-	else {
+	else 
 #ifdef USE_GMODULE
-		ret = _gdk_pixbuf_load_module_unlocked (image_module, error);
+	{
+		char *path;
+		GModule *module;
+		gpointer sym;
+
+		path = image_module->module_path;
+		module = g_module_open (path, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
+
+        	if (!module) {
+                	g_set_error (error,
+                             	     GDK_PIXBUF_ERROR,
+                             	     GDK_PIXBUF_ERROR_FAILED,
+                             	     _("Unable to load image-loading module: %s: %s"),
+                             	     path, g_module_error ());
+                	return FALSE;
+        	}
+
+		image_module->module = module;        
+        
+        	if (g_module_symbol (module, "fill_vtable", &sym)) {
+                	fill_vtable = (GdkPixbufModuleFillVtableFunc) sym;
+                	(* fill_vtable) (image_module);
+                	return TRUE;
+        	} else {
+                	g_set_error (error,
+                        	     GDK_PIXBUF_ERROR,
+                             	     GDK_PIXBUF_ERROR_FAILED,
+                             	     _("Image-loading module %s does not export the proper interface; perhaps it's from a different GTK version?"),
+                             	     path);
+                	return FALSE;
+        	}
+	}
 #else
-		g_set_error (error,
-			     GDK_PIXBUF_ERROR,
-			     GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
-			     _("Image type '%s' is not supported",
-			     image_module->module_name);
+	g_set_error (error,
+		     GDK_PIXBUF_ERROR,
+		     GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
+		     _("Image type '%s' is not supported",
+		     image_module->module_name);
+	return FALSE;
+#endif  /* !USE_GMODULE */
+}
 
-		ret = FALSE;
-#endif
+
+gboolean
+_gdk_pixbuf_load_module (GdkPixbufModule *image_module,
+			 GError         **error)
+{
+	gboolean ret;
+	gboolean locked = FALSE;
+
+	/* be extra careful, maybe the module initializes
+	 * the thread system
+	 */
+	if (g_threads_got_initialized) {
+		G_LOCK (init_lock);
+		locked = TRUE;
 	}
 
+        ret = gdk_pixbuf_load_module_unlocked (image_module, error);
+
 	if (locked)
 		G_UNLOCK (init_lock);
 


Index: gtk2.spec
===================================================================
RCS file: /cvs/extras/rpms/gtk2/devel/gtk2.spec,v
retrieving revision 1.317
retrieving revision 1.318
diff -u -r1.317 -r1.318
--- gtk2.spec	4 Sep 2008 19:20:53 -0000	1.317
+++ gtk2.spec	5 Sep 2008 01:05:26 -0000	1.318
@@ -16,7 +16,7 @@
 Summary: The GIMP ToolKit (GTK+), a library for creating GUIs for X
 Name: gtk2
 Version: %{base_version}
-Release: 1%{?dist}
+Release: 2%{?dist}
 License: LGPLv2+
 Group: System Environment/Libraries
 Source: http://download.gnome.org/sources/gtk+/2.14/gtk+-%{version}.tar.bz2
@@ -30,6 +30,8 @@
 # a workaround for some brokenness in the flash plugin
 # see http://bugzilla.gnome.org/show_bug.cgi?id=463773
 Patch2: workaround.patch
+# fixed upstream
+Patch3: init-deadlock.patch
 
 BuildRequires: atk-devel >= %{atk_version}
 BuildRequires: pango-devel >= %{pango_version}
@@ -115,6 +117,7 @@
 %patch0 -p1 -b .lib64
 %patch1 -p1 -b .set-invisible-char-to-bullet
 %patch2 -p1 -b .workaround
+%patch3 -p0 -b .init-deadlock
 
 for i in config.guess config.sub ; do
   test -f %{_datadir}/libtool/$i && cp %{_datadir}/libtool/$i .
@@ -298,6 +301,9 @@
 %{_datadir}/gtk-2.0
 
 %changelog
+* Thu Sep  4 2008 Matthias Clasen <mclasen at redhat.com> - 2.14.0-2
+- Fix a deadlock in pixbuf loader initialization
+
 * Thu Sep  4 2008 Matthias Clasen <mclasen at redhat.com> - 2.14.0-1
 - Update to 2.14.0
 




More information about the fedora-extras-commits mailing list