Skip to content

Commit ccd54ca

Browse files
committed
inputcapture: Consistently end the Call iff the GTask has completed
After the previous commit ensured that the GTask is always given a result at all appropriate times, this should not make any practical difference. However, it hopefully makes the intention clearer: after the GTask has completed, we always dispose the Call, and if the GTask has not yet completed, we never do. Signed-off-by: Simon McVittie <[email protected]>
1 parent 207eaaa commit ccd54ca

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

libportal/inputcapture.c

+3-5
Original file line numberDiff line numberDiff line change
@@ -619,8 +619,6 @@ get_zones_done (GDBusConnection *bus,
619619
{
620620
set_zones (session, zones, zone_set);
621621
g_task_return_pointer (call->task, g_steal_pointer (&session), g_object_unref);
622-
/* Now the Call succeeded, we can ignore any subsequent method replies */
623-
call_dispose (call);
624622
}
625623
else
626624
{
@@ -636,8 +634,8 @@ get_zones_done (GDBusConnection *bus,
636634
else if (response != 0)
637635
g_task_return_new_error (call->task, G_IO_ERROR, G_IO_ERROR_FAILED, "InputCapture GetZones() unknown response code %d", response);
638636

639-
/* If the Call failed, we can ignore any subsequent method replies */
640-
if (response != 0)
637+
/* If the Call succeeded or failed, we can ignore any subsequent method replies */
638+
if (g_task_get_completed (call->task))
641639
call_dispose (call);
642640
}
643641

@@ -705,7 +703,7 @@ session_created (GDBusConnection *bus,
705703
g_task_return_new_error (call->task, G_IO_ERROR, G_IO_ERROR_FAILED, "InputCapture CreateSession() unknown response code %d", response);
706704

707705
/* If the Call failed, we can ignore any subsequent method replies */
708-
if (response != 0)
706+
if (g_task_get_completed (call->task))
709707
call_dispose (call);
710708
}
711709

0 commit comments

Comments
 (0)