Merge branch 'coverity-is-stupid' into 'main'

gobject: Change GObject notify semantics under static analysis

See merge request GNOME/glib!2747
This commit is contained in:
Philip Withnall 2022-06-17 15:47:39 +00:00
commit b2f4df95e8

View File

@ -1527,13 +1527,24 @@ g_object_notify_by_spec_internal (GObject *object,
}
else
{
/*
* Coverity doesnt understand the paired ref/unref here and seems to
* ignore the ref, thus reports every call to g_object_notify() as
* causing a double-free. Thats incorrect, but I cant get a model
* file to work for avoiding the false positives, so instead comment
* out the ref/unref when doing static analysis.
*/
#ifndef __COVERITY__
g_object_ref (object);
#endif
/* not frozen, so just dispatch the notification directly */
G_OBJECT_GET_CLASS (object)
->dispatch_properties_changed (object, 1, &pspec);
#ifndef __COVERITY__
g_object_unref (object);
#endif
}
}
}