mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-09 10:44: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;
|
||||
|
||||
if (object)
|
||||
g_weak_ref_set (weak_ref, object);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user