mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-05-20 04:22:11 +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:
parent
de5e26e2ed
commit
aaf4ccb901
@ -5001,7 +5001,8 @@ g_weak_ref_init (GWeakRef *weak_ref,
|
|||||||
{
|
{
|
||||||
weak_ref->priv.p = NULL;
|
weak_ref->priv.p = NULL;
|
||||||
|
|
||||||
g_weak_ref_set (weak_ref, object);
|
if (object)
|
||||||
|
g_weak_ref_set (weak_ref, object);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user