Skip to content

Commit d5bbec2

Browse files
committed
inputcapture: Assert that we don't receive Response signals after dispose
When the Call object is disposed, it unsubscribes from the Response signal before releasing its GTask reference, so it should be impossible to get into the Response handler after dispose. Clarify that. Signed-off-by: Simon McVittie <smcv@debian.org>
1 parent ccd54ca commit d5bbec2

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

libportal/inputcapture.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,10 @@ get_zones_done (GDBusConnection *bus,
544544
guint32 response;
545545
g_autoptr(GVariant) ret = NULL;
546546

547+
/* If the Call has already been disposed, we should have unsubscribed
548+
* from the Response signal at that time, so we shouldn't get here */
549+
g_return_if_fail (G_IS_TASK (call->task));
550+
547551
g_variant_get (parameters, "(u@a{sv})", &response, &ret);
548552

549553
if (response != 0)
@@ -677,6 +681,10 @@ session_created (GDBusConnection *bus,
677681
guint32 response;
678682
g_autoptr(GVariant) ret = NULL;
679683

684+
/* If the Call has already been disposed, we should have unsubscribed
685+
* from the Response signal at that time, so we shouldn't get here */
686+
g_return_if_fail (G_IS_TASK (call->task));
687+
680688
g_variant_get (parameters, "(u@a{sv})", &response, &ret);
681689

682690
if (response != 0)
@@ -956,6 +964,10 @@ set_pointer_barriers_done (GDBusConnection *bus,
956964
GVariant *failed = NULL;
957965
GList *failed_list = NULL;
958966

967+
/* If the Call has already been disposed, we should have unsubscribed
968+
* from the Response signal at that time, so we shouldn't get here */
969+
g_return_if_fail (G_IS_TASK (call->task));
970+
959971
g_variant_get (parameters, "(u@a{sv})", &response, &ret);
960972

961973
if (g_variant_lookup (ret, "failed_barriers", "@au", &failed))

0 commit comments

Comments
 (0)