[Spice-devel] [PATCH spice-gtk] Remove g_object_{set, get}_data() usage
Hans de Goede
hdegoede at redhat.com
Mon Nov 7 06:43:20 PST 2011
Hi,
Looks like a nice cleanup to me :)
I've one remark though, see below.
On 11/07/2011 03:01 PM, Marc-André Lureau wrote:
> This is not really clean, as it may conflict with client usage
> ---
> gtk/spice-audio.c | 7 ++---
> gtk/spice-gtk-session.c | 20 +++------------
> gtk/spice-session-priv.h | 58 ++++++++++++++++++++++++++++++++++++++++++++++
> gtk/spice-session.c | 56 +++-----------------------------------------
> gtk/usb-device-manager.c | 19 ++------------
> 5 files changed, 72 insertions(+), 88 deletions(-)
>
<snip>
> @@ -196,6 +144,10 @@ spice_session_dispose(GObject *gobject)
> s->migration_left = NULL;
> }
>
> + g_clear_object(&s->audio_manager);
> + g_clear_object(&s->gtk_session);
> + g_clear_object(&s->usb_manager);
> +
> /* Chain up to the parent class */
> if (G_OBJECT_CLASS(spice_session_parent_class)->dispose)
> G_OBJECT_CLASS(spice_session_parent_class)->dispose(gobject);
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);
if (s->gtk_session)
g_clear_object(&s->gtk_session);
if (s->usb_manager)
g_clear_object(&s->usb_manager);
Regards,
Hans
More information about the Spice-devel
mailing list