rpms/glib2/F-9 class-init-race.patch, NONE, 1.1 glib2.spec, 1.167, 1.168
Matthias Clasen (mclasen)
fedora-extras-commits at redhat.com
Tue Jun 17 03:12:01 UTC 2008
Author: mclasen
Update of /cvs/extras/rpms/glib2/F-9
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv4500
Modified Files:
glib2.spec
Added Files:
class-init-race.patch
Log Message:
fix a race in class initialization
class-init-race.patch:
--- NEW FILE class-init-race.patch ---
--- trunk/gobject/gtype.c 2008/02/05 17:52:52 6454
+++ trunk/gobject/gtype.c 2008/06/10 11:41:34 6985
@@ -2363,20 +2363,19 @@
g_type_class_ref (GType type)
{
TypeNode *node;
-
- /* optimize for common code path
- */
+ GType ptype;
+
+ /* optimize for common code path */
G_WRITE_LOCK (&type_rw_lock);
node = lookup_type_node_I (type);
if (node && node->is_classed && node->data &&
- node->data->class.class && node->data->common.ref_count > 0)
+ node->data->class.class &&
+ node->data->class.init_state == INITIALIZED)
{
type_data_ref_Wm (node);
G_WRITE_UNLOCK (&type_rw_lock);
-
return node->data->class.class;
}
-
if (!node || !node->is_classed ||
(node->data && node->data->common.ref_count < 1))
{
@@ -2385,33 +2384,28 @@
type_descriptive_name_I (type));
return NULL;
}
-
type_data_ref_Wm (node);
+ ptype = NODE_PARENT_TYPE (node);
+ G_WRITE_UNLOCK (&type_rw_lock);
+ g_static_rec_mutex_lock (&class_init_rec_mutex); /* required locking order: 1) class_init_rec_mutex, 2) type_rw_lock */
+ /* here, we either have node->data->class.class == NULL, or a recursive
+ * call to g_type_class_ref() with a partly initialized class, or
+ * node->data->class.init_state == INITIALIZED, because any
+ * concurrently running initialization was guarded by class_init_rec_mutex.
+ */
if (!node->data->class.class) /* class uninitialized */
{
- GType ptype = NODE_PARENT_TYPE (node);
- GTypeClass *pclass = NULL;
- G_WRITE_UNLOCK (&type_rw_lock);
- g_static_rec_mutex_lock (&class_init_rec_mutex); /* required locking order: 1) class_init_rec_mutex, 2) type_rw_lock */
- if (ptype)
- {
- pclass = g_type_class_ref (ptype);
- G_WRITE_LOCK (&type_rw_lock);
- node = lookup_type_node_I (type);
- if (node->data->class.class)
- INVALID_RECURSION ("g_type_plugin_*", node->plugin, NODE_NAME (node));
- }
- else
- {
- G_WRITE_LOCK (&type_rw_lock);
- node = lookup_type_node_I (type);
- }
- if (!node->data->class.class) /* class could have been initialized meanwhile */
- type_class_init_Wm (node, pclass);
+ /* acquire reference on parent class */
+ GTypeClass *pclass = ptype ? g_type_class_ref (ptype) : NULL;
+ G_WRITE_LOCK (&type_rw_lock);
+ if (node->data->class.class) /* class was initialized during parent class initialization? */
+ INVALID_RECURSION ("g_type_plugin_*", node->plugin, NODE_NAME (node));
+ type_class_init_Wm (node, pclass);
G_WRITE_UNLOCK (&type_rw_lock);
- g_static_rec_mutex_unlock (&class_init_rec_mutex);
}
+ g_static_rec_mutex_unlock (&class_init_rec_mutex);
+
return node->data->class.class;
}
Index: glib2.spec
===================================================================
RCS file: /cvs/extras/rpms/glib2/F-9/glib2.spec,v
retrieving revision 1.167
retrieving revision 1.168
diff -u -r1.167 -r1.168
--- glib2.spec 28 Apr 2008 22:49:26 -0000 1.167
+++ glib2.spec 17 Jun 2008 03:11:16 -0000 1.168
@@ -3,7 +3,7 @@
Summary: A library of handy utility functions
Name: glib2
Version: 2.16.3
-Release: 5%{?dist}
+Release: 6%{?dist}
License: LGPLv2+
Group: System Environment/Libraries
URL: http://www.gtk.org
@@ -32,6 +32,9 @@
# http://bugzilla.gnome.org/show_bug.cgi?id=526320
Patch3: glib-2.16.3-ignore-inaccessible-mounts.patch
+# fixed upstream
+Patch4: class-init-race.patch
+
%description
GLib is the low-level core library that forms the basis
for projects such as GTK+ and GNOME. It provides data structure
@@ -67,6 +70,7 @@
%patch1 -R -p1 -b .revert-316221
%patch2 -p0 -b .only-pass-uri-to-gio-apps
%patch3 -p0 -b .ignore-inaccessible-mounts
+%patch4 -p1 -b .class-init-race
%build
%configure --disable-gtk-doc --enable-static
@@ -139,6 +143,10 @@
%{_libdir}/lib*.a
%changelog
+* Mon Jun 16 2008 Matthias Clasen <mclasen at redhat.com> - 2.16.3-6
+- Fix a race in class initialization that causes assertion
+ failures and crashes
+
* Mon Apr 28 2008 Warren Togami <wtogami at redhat.com> - 2.16.3-5
- Ignore inaccessible mounts during mountpoint enumeration (GNOME #526320)
This prevents bogus inaccessible devices owned by one user from appearing
More information about the fedora-extras-commits
mailing list