+Fri Oct 27 05:35:14 2000 Tim Janik <timj@gtk.org>
+
+ * gsignal.c (g_signal_newv): fixed deadlock scenarion where
+ g_signal_lookup() would be called with the signal lock being
+ held. reported by james henstridge.
+
+ * gclosure.c (g_closure_set_meta_marshal): fixed memcpy/overwrite bug
+ reported by owen.
+
2000-10-26 Tor Lillqvist <tml@iki.fi>
* gbsearcharray.c (bsearch_array_insert): Fix gccisms (pointer
n = CLOSURE_N_NOTIFIERS (closure);
notifiers = closure->notifiers;
closure->notifiers = g_renew (GClosureNotifyData, NULL, CLOSURE_N_NOTIFIERS (closure) + 1);
- closure->notifiers[0].data = marshal_data;
- closure->notifiers[0].notify = (GClosureNotify) meta_marshal;
if (notifiers)
{
/* usually the meta marshal will be setup right after creation, so the
- * memcpy() should be rare-case scenario
+ * g_memmove() should be rare-case scenario
*/
- memcpy (closure->notifiers + 1, notifiers, CLOSURE_N_NOTIFIERS (closure) * sizeof (notifiers[0]));
+ g_memmove (closure->notifiers + 1, notifiers, CLOSURE_N_NOTIFIERS (closure) * sizeof (notifiers[0]));
g_free (notifiers);
}
+ closure->notifiers[0].data = marshal_data;
+ closure->notifiers[0].notify = (GClosureNotify) meta_marshal;
closure->meta_marshal = 1;
}
signal_id_lookup (GQuark quark,
GType itype)
{
- SignalKey key, *signal_key;
-
- key.itype = itype;
- key.quark = quark;
-
- signal_key = g_bsearch_array_lookup (&g_signal_key_bsa, &key);
+ do
+ {
+ SignalKey key, *signal_key;
+
+ key.itype = itype;
+ key.quark = quark;
+
+ signal_key = g_bsearch_array_lookup (&g_signal_key_bsa, &key);
+
+ if (signal_key)
+ return signal_key->signal_id;
+
+ itype = g_type_parent (itype);
+ }
+ while (itype);
- return signal_key ? signal_key->signal_id : 0;
+ return 0;
}
static gint
g_signal_lookup (const gchar *name,
GType itype)
{
- GQuark quark;
-
+ guint signal_id;
+
g_return_val_if_fail (name != NULL, 0);
g_return_val_if_fail (G_TYPE_IS_INSTANTIATABLE (itype) || G_TYPE_IS_INTERFACE (itype), 0);
G_LOCK (g_signal_mutex);
- quark = g_quark_try_string (name);
- if (quark)
- do
- {
- guint signal_id = signal_id_lookup (quark, itype);
-
- if (signal_id)
- return signal_id;
-
- itype = g_type_parent (itype);
- }
- while (itype);
+ signal_id = signal_id_lookup (g_quark_try_string (name), itype);
G_UNLOCK (g_signal_mutex);
- return 0;
+ return signal_id;
}
gchar*
G_LOCK (g_signal_mutex);
- signal_id = g_signal_lookup (name, itype);
+ signal_id = signal_id_lookup (g_quark_try_string (name), itype);
node = LOOKUP_SIGNAL_NODE (signal_id);
if (node && !node->destroyed)
{