gobject: Change GObject notify semantics under static analysis
Coverity notices the g_object_unref()
call in g_object_notify()
, but
not the paired g_object_ref()
call. It therefore incorrectly assumes
that every call to g_object_notify()
frees the object. This causes a
lot (hundreds) of false positive reports about double-frees or
use-after-frees.
I can’t find a way to fix this using a model file, so the other options are:
- Manually mark every report as a false positive and keep updating them as the code changes over time. This would take a lot of maintainer effort.
- Comment out the
g_object_ref()
/g_object_unref()
calls when running static analysis (but not in a normal production build). This is ugly, but cheap and shouldn’t impact maintainability much.
So this commit implements option 2.
Signed-off-by: Philip Withnall pwithnall@endlessos.org