summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Grunt <pgrunt@redhat.com>2016-03-21 13:50:55 +0100
committerPavel Grunt <pgrunt@redhat.com>2016-03-22 11:39:23 +0100
commit6c8df8caa79817d07e1185ad2bd0312ecb9ef37d (patch)
tree435e245dffb2c4b7b0667fe795a046b3550fa0fa
parentae8f97eb5a1a735dfeca688c437729ba47a379f1 (diff)
downloadspice-gtk-6c8df8caa79817d07e1185ad2bd0312ecb9ef37d.tar.gz
spice-gtk-6c8df8caa79817d07e1185ad2bd0312ecb9ef37d.tar.xz
spice-gtk-6c8df8caa79817d07e1185ad2bd0312ecb9ef37d.zip
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@redhat.com>
-rw-r--r--src/spice-pulse.c4
-rw-r--r--src/vmcstream.c15
2 files changed, 4 insertions, 15 deletions
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);
}