[Spice-commits] src/spice-pulse.c src/vmcstream.c
Pavel Grunt
pgrunt at kemper.freedesktop.org
Tue Mar 22 10:39:45 UTC 2016
src/spice-pulse.c | 4 +---
src/vmcstream.c | 15 +++------------
2 files changed, 4 insertions(+), 15 deletions(-)
New commits:
commit 6c8df8caa79817d07e1185ad2bd0312ecb9ef37d
Author: Pavel Grunt <pgrunt at redhat.com>
Date: Mon Mar 21 13:50:55 2016 +0100
Remove extra checks before g_cancellable_disconnect()
If cancellable is NULL or handler_id is 0 the function does nothing.
Acked-by: Victor Toso <victortoso at redhat.com>
diff --git a/src/spice-pulse.c b/src/spice-pulse.c
index 8d45dbe..6bc3014 100644
--- a/src/spice-pulse.c
+++ b/src/spice-pulse.c
@@ -945,9 +945,7 @@ static gboolean free_async_task(gpointer user_data)
if (task->pa_op != NULL)
pa_operation_unref(task->pa_op);
- if (task->cancel_id != 0)
- g_cancellable_disconnect(g_task_get_cancellable(task->gtask),
- task->cancel_id);
+ g_cancellable_disconnect(g_task_get_cancellable(task->gtask), task->cancel_id);
if (task->gtask)
g_object_unref(task->gtask);
diff --git a/src/vmcstream.c b/src/vmcstream.c
index 48f9513..a206961 100644
--- a/src/vmcstream.c
+++ b/src/vmcstream.c
@@ -116,7 +116,6 @@ spice_vmc_input_stream_co_data(SpiceVmcInputStream *self,
self->coroutine = coroutine_self();
while (size > 0) {
- GCancellable *cancellable;
SPICE_DEBUG("spicevmc co_data %p", self->task);
if (!self->task)
coroutine_yield(NULL);
@@ -140,9 +139,7 @@ spice_vmc_input_stream_co_data(SpiceVmcInputStream *self,
g_task_return_int(self->task, self->pos);
- cancellable = g_task_get_cancellable(self->task);
- if (cancellable)
- g_cancellable_disconnect(cancellable, self->cancel_id);
+ g_cancellable_disconnect(g_task_get_cancellable(self->task), self->cancel_id);
g_clear_object(&self->task);
}
@@ -208,16 +205,13 @@ spice_vmc_input_stream_read_all_finish(GInputStream *stream,
GError **error)
{
GTask *task = G_TASK(result);
- GCancellable *cancellable;
SpiceVmcInputStream *self = SPICE_VMC_INPUT_STREAM(stream);
g_return_val_if_fail(g_task_is_valid(task, self), -1);
/* FIXME: calling _finish() is required. Disconnecting in
read_cancelled() causes a deadlock. #705395 */
- cancellable = g_task_get_cancellable(task);
- if (cancellable)
- g_cancellable_disconnect(cancellable, self->cancel_id);
+ g_cancellable_disconnect(g_task_get_cancellable(task), self->cancel_id);
return g_task_propagate_int(task, error);
}
@@ -258,16 +252,13 @@ spice_vmc_input_stream_read_finish(GInputStream *stream,
GError **error)
{
GTask *task = G_TASK(result);
- GCancellable *cancellable;
SpiceVmcInputStream *self = SPICE_VMC_INPUT_STREAM(stream);
g_return_val_if_fail(g_task_is_valid(task, self), -1);
/* FIXME: calling _finish() is required. Disconnecting in
read_cancelled() causes a deadlock. #705395 */
- cancellable = g_task_get_cancellable(task);
- if (cancellable)
- g_cancellable_disconnect(cancellable, self->cancel_id);
+ g_cancellable_disconnect(g_task_get_cancellable(task), self->cancel_id);
return g_task_propagate_int(task, error);
}
More information about the Spice-commits
mailing list