summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author4 <timj@birnet.org>2004-10-06 00:16:23 +0000
committerTim Janik <timj@src.gnome.org>2004-10-06 00:16:23 +0000
commit3a3519b571ba7169c59092a738f4ab8f743012e3 (patch)
treea20656a33a51334e1d20501645373dfb932e8ada
parent5ba7ba03745a69956b79926e270586b7f0c9f6ea (diff)
applied patch from Jean-Yves Lefort <jylefort@brutele.be> to not access
Wed Oct 6 02:12:44 2004 <timj@birnet.org> * gtype.c (g_type_instance_get_private): applied patch from Jean-Yves Lefort <jylefort@brutele.be> to not access the instance_real_class_bsa pointer without holding the instance_real_class lock.
-rw-r--r--gobject/ChangeLog6
-rw-r--r--gobject/gtype.c11
2 files changed, 9 insertions, 8 deletions
diff --git a/gobject/ChangeLog b/gobject/ChangeLog
index f7788f474..8efcc93af 100644
--- a/gobject/ChangeLog
+++ b/gobject/ChangeLog
@@ -1,3 +1,9 @@
+Wed Oct 6 02:12:44 2004 <timj@birnet.org>
+
+ * gtype.c (g_type_instance_get_private): applied patch from Jean-Yves
+ Lefort <jylefort@brutele.be> to not access the instance_real_class_bsa
+ pointer without holding the instance_real_class lock.
+
2004-09-22 Tor Lillqvist <tml@iki.fi>
* Makefile.am (install-libtool-import-lib): [Win32] Add code to
diff --git a/gobject/gtype.c b/gobject/gtype.c
index 3808ed1fd..9b25752af 100644
--- a/gobject/gtype.c
+++ b/gobject/gtype.c
@@ -1514,7 +1514,7 @@ instance_real_class_get (gpointer instance)
InstanceRealClass key, *node;
key.instance = instance;
G_LOCK (instance_real_class);
- node = g_bsearch_array_lookup (instance_real_class_bsa, &instance_real_class_bconfig, &key);
+ node = instance_real_class_bsa ? g_bsearch_array_lookup (instance_real_class_bsa, &instance_real_class_bconfig, &key) : NULL;
G_UNLOCK (instance_real_class);
return node ? node->class : NULL;
}
@@ -3546,13 +3546,8 @@ g_type_instance_get_private (GTypeInstance *instance,
/* while instances are initialized, their class pointers change,
* so figure the instances real class first
*/
- if (instance_real_class_bsa)
- {
- class = instance_real_class_get (instance);
- if (!class)
- class = instance->g_class;
- }
- else
+ class = instance_real_class_get (instance);
+ if (!class)
class = instance->g_class;
instance_node = lookup_type_node_I (class->g_type);