gsignal: Do not try to lookup the signal id and work on unlocked node

In g_signal_parse_name we were looking up for the signal from the name
keeping the mutex locked, but we then retrieved and checked the node
data without keeping the lock, so with another thread potentially
changing that.
This commit is contained in:
Marco Trevisan (Treviño) 2022-07-15 16:09:14 +02:00
parent ae14f3219a
commit 42d52033db

View File

@ -1216,12 +1216,17 @@ g_signal_parse_name (const gchar *detailed_signal,
SIGNAL_LOCK (); SIGNAL_LOCK ();
signal_id = signal_parse_name (detailed_signal, itype, &detail, force_detail_quark); signal_id = signal_parse_name (detailed_signal, itype, &detail, force_detail_quark);
SIGNAL_UNLOCK ();
node = signal_id ? LOOKUP_SIGNAL_NODE (signal_id) : NULL; node = signal_id ? LOOKUP_SIGNAL_NODE (signal_id) : NULL;
if (!node || node->destroyed || if (!node || node->destroyed ||
(detail && !(node->flags & G_SIGNAL_DETAILED))) (detail && !(node->flags & G_SIGNAL_DETAILED)))
return FALSE; {
SIGNAL_UNLOCK ();
return FALSE;
}
SIGNAL_UNLOCK ();
if (signal_id_p) if (signal_id_p)
*signal_id_p = signal_id; *signal_id_p = signal_id;