[Spice-devel] [PATCH spice-gtk v2] vmcstream: set the right result for the task
Fabiano Fidêncio
fidencio at redhat.com
Wed Jul 27 10:42:44 UTC 2016
On Wed, Jul 27, 2016 at 12:39 PM, Christophe Fergeau
<cfergeau at redhat.com> wrote:
> On Wed, Jul 27, 2016 at 11:17:38AM +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..ffb1ba4 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, g_object_ref(res), g_object_unref);
>>
>> g_object_unref(task);
>> }
>
> You'll also need
>
> diff --git a/src/vmcstream.c b/src/vmcstream.c
> index c536f71..32d8b5e 100644
> --- a/src/vmcstream.c
> +++ b/src/vmcstream.c
> @@ -399,9 +399,13 @@ spice_vmc_output_stream_write_finish(GOutputStream *stream,
> {
> SpiceVmcOutputStream *self = SPICE_VMC_OUTPUT_STREAM(stream);
> GAsyncResult *res = g_task_propagate_pointer(G_TASK(simple), error);
> + gssize bytes_written;
>
> SPICE_DEBUG("spicevmc write finish");
> - return spice_vmc_write_finish(self->channel, res, error);
> + bytes_written = spice_vmc_write_finish(self->channel, res, error);
> + g_object_unref(res);
> +
> + return bytes_written;
> }
>
> static void
>
>
> (but this is arguably a slightly different bug which was already existing
> before your change).
Feel free to squash my patch into your change or push both separately.
Best Regards,
--
Fabiano Fidêncio
More information about the Spice-devel
mailing list