mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-12 20:24:04 +02:00
gobject: avoid calling g_weak_ref_set() when intializing GWeakRef to NULL
If object is NULL, g_weak_ref_set() really does nothing. However, it will pointlessly take a lock, before deciding to do nothing. Avoid that.
This commit is contained in:
@@ -5001,6 +5001,7 @@ g_weak_ref_init (GWeakRef *weak_ref,
|
|||||||
{
|
{
|
||||||
weak_ref->priv.p = NULL;
|
weak_ref->priv.p = NULL;
|
||||||
|
|
||||||
|
if (object)
|
||||||
g_weak_ref_set (weak_ref, object);
|
g_weak_ref_set (weak_ref, object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user