[Spice-devel] [PATCH spice-gtk] Remove g_object_{set, get}_data() usage

Marc-André Lureau mlureau at redhat.com
Mon Nov 7 06:55:30 PST 2011


Hi

> AFAIK you may only call g_clear_object on non NULL GObject pointers,
> and if the matching foo_get was never called, it will be NULL, so
> I believe this should be:
> 
>      if (s->audio_manager)
>          g_clear_object(&s->audio_manager);

g_clear_object() doesn't want a NULL pointer (to a pointer of GObject, NULL or no).

See implementation: http://git.gnome.org/browse/glib/tree/gobject/gobject.c#n2785

I think in general, all the g_clear_* functions handle it similarly.

regards


More information about the Spice-devel mailing list