gobject: Add an assertion to avoid a static analysis false positive

Avoid scan-build thinking that `new_wrdata` could be `NULL` on this
control path. It can’t be `NULL` if `new_object` is set.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #1767
This commit is contained in:
Philip Withnall 2024-04-09 17:00:51 +01:00
parent 62b5c738e7
commit 6a1beede60
No known key found for this signature in database
GPG Key ID: DCDF5885B1F3ED73

View File

@ -5606,6 +5606,7 @@ _weak_ref_set (GWeakRef *weak_ref,
if (new_object)
{
#if G_ENABLE_DEBUG
g_assert (new_wrdata != NULL);
g_assert (weak_ref_data_list_find (new_wrdata, weak_ref) < 0);
#endif
if (g_atomic_int_get (&new_object->ref_count) < 1)