[Spice-devel] [PATCH spice-gtk 1/2] Don't unref GAsyncResult in callback

Marc-André Lureau marcandre.lureau at gmail.com
Tue Jun 5 17:15:09 UTC 2018


Hi

On Thu, May 31, 2018 at 8:35 PM, Jonathon Jongsma <jjongsma at redhat.com> wrote:
> A GAsyncReadCallback function should not unref the GAsyncResult passed
> to it as an argument since it does not hold a reference. This could
> cause a double-free error (or a glib warning that it is not a valid
> GObject)..

Would be worth to have the critical or double-free backtrace, but your
analysis seems right to me.

This was introduced by commit 9fbf679453d8dbfe797a738cb536136599d7adab
"usbredir: Disconnect USB device asynchronously"

ack

> ---
>  src/channel-usbredir.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c
> index 0cc5630..b7445b0 100644
> --- a/src/channel-usbredir.c
> +++ b/src/channel-usbredir.c
> @@ -151,7 +151,6 @@ static void _channel_reset_cb(GObject *gobject,
>      SPICE_CHANNEL_CLASS(spice_usbredir_channel_parent_class)->channel_reset(spice_channel, migrating);
>
>      spice_usbredir_channel_disconnect_device_finish(channel, result, &err);
> -    g_object_unref(result);
>  }
>
>  static void spice_usbredir_channel_reset(SpiceChannel *c, gboolean migrating)
> --
> 2.14.3
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel



-- 
Marc-André Lureau


More information about the Spice-devel mailing list