[Spice-devel] [PATCH spice-gtk] vmcstream: set the right result for the task

Christophe Fergeau cfergeau at redhat.com
Wed Jul 27 07:07:49 UTC 2016


Hey,

On Wed, Jul 27, 2016 at 04:34:18AM +0200, Fabiano FidĂȘncio wrote:
> This bogus code was introduced when switching to GTask API. Seems that
> while writing those patches I just overlooked this part and set the wrong
> result for the task. As part of the problems introduced (and now fixed)
> you can notice that no output stream was being sent to the guest.
> 
> Signed-off-by: Fabiano FidĂȘncio <fidencio at redhat.com>
> ---
>  src/vmcstream.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/vmcstream.c b/src/vmcstream.c
> index c536f71..7c7af44 100644
> --- a/src/vmcstream.c
> +++ b/src/vmcstream.c
> @@ -411,7 +411,7 @@ write_cb(GObject *source_object,
>  {
>      GTask *task = user_data;
>  
> -    g_task_return_pointer(task, g_object_ref(task), g_object_unref);
> +    g_task_return_pointer(task, res, NULL);

Good catch! I'd take a ref on 'res' though as it's getting to get
destroyed as soon as write_cb returns, and you don't know for sure
whether g_task_return_pointer() is going to run in an idle or not,
you don't know if the callback is going to call _finish() right away,
...
So it feels safer overall to take a reference on 'res' as we need it to
stay alive.

Reviewed-by: Christophe Fergeau <cfergeau at redhat.com>

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20160727/fc4ce063/attachment.sig>


More information about the Spice-devel mailing list