summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksandermj@chromium.org>2023-05-03 14:25:51 +0000
committerAleksander Morgado <aleksandermj@chromium.org>2023-05-03 14:25:51 +0000
commitf3cdafb746bfa661e7e4ab553bd757eeba7d27c9 (patch)
treef88b3016bfd6aa4048bc79c17dddd0e652e0f1f4
parent28eec45dbb8fca7e51165b29cd6a36c7ef78abb4 (diff)
downloadModemManager-f3cdafb746bfa661e7e4ab553bd757eeba7d27c9.tar.gz
shared-qmi: don't assume cancellation signal handler is setup in the registration wait
The cancellation_id will not be set if the cancellable is already cancelled by the time g_cancellable_connect() is called.
-rw-r--r--src/mm-shared-qmi.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/mm-shared-qmi.c b/src/mm-shared-qmi.c
index 236dbcf62..31e372ad7 100644
--- a/src/mm-shared-qmi.c
+++ b/src/mm-shared-qmi.c
@@ -210,8 +210,8 @@ register_in_network_cancelled (GCancellable *cancellable,
ctx = g_task_get_task_data (task);
g_assert (ctx->cancellable);
- g_assert (ctx->cancellable_id);
- ctx->cancellable_id = 0;
+ if (ctx->cancellable_id)
+ ctx->cancellable_id = 0;
g_assert (ctx->timeout_id);
g_source_remove (ctx->timeout_id);
@@ -241,9 +241,10 @@ register_in_network_timeout (GTask *task)
g_signal_handler_disconnect (ctx->client, ctx->serving_system_indication_id);
ctx->serving_system_indication_id = 0;
- g_assert (!ctx->cancellable || ctx->cancellable_id);
- g_cancellable_disconnect (ctx->cancellable, ctx->cancellable_id);
- ctx->cancellable_id = 0;
+ if (ctx->cancellable && ctx->cancellable_id) {
+ g_cancellable_disconnect (ctx->cancellable, ctx->cancellable_id);
+ ctx->cancellable_id = 0;
+ }
/* the 3GPP interface will take care of checking if the registration is
* the one we asked for */
@@ -283,9 +284,10 @@ register_in_network_ready (GTask *task,
g_source_remove (ctx->timeout_id);
ctx->timeout_id = 0;
- g_assert (!ctx->cancellable || ctx->cancellable_id);
- g_cancellable_disconnect (ctx->cancellable, ctx->cancellable_id);
- ctx->cancellable_id = 0;
+ if (ctx->cancellable && ctx->cancellable_id) {
+ g_cancellable_disconnect (ctx->cancellable, ctx->cancellable_id);
+ ctx->cancellable_id = 0;
+ }
/* the 3GPP interface will take care of checking if the registration is
* the one we asked for */