summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine Faure <antoine.faure@sigfox.com>2019-10-09 16:10:09 +0200
committerThomas Haller <thaller@redhat.com>2019-10-23 15:23:52 +0200
commit105ee6e5a9aae373e88d54ecbcd83ccb134cfc97 (patch)
treebfea826d75b96f6ee05ad9f73fa685b38e42f965
parent7efc3c479f8abd46d601105c1f618d529352a86a (diff)
downloadNetworkManager-105ee6e5a9aae373e88d54ecbcd83ccb134cfc97.tar.gz
device: fix crash by handling connection cancellation
-rw-r--r--src/devices/wwan/nm-modem-broadband.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/devices/wwan/nm-modem-broadband.c b/src/devices/wwan/nm-modem-broadband.c
index 9910ffdb27..0510902a31 100644
--- a/src/devices/wwan/nm-modem-broadband.c
+++ b/src/devices/wwan/nm-modem-broadband.c
@@ -341,16 +341,23 @@ connect_ready (MMModemSimple *simple_iface,
GAsyncResult *res,
NMModemBroadband *self)
{
- ConnectContext *ctx = self->_priv.ctx;
+ ConnectContext *ctx = NULL;
GError *error = NULL;
NMModemIPMethod ip4_method = NM_MODEM_IP_METHOD_UNKNOWN;
NMModemIPMethod ip6_method = NM_MODEM_IP_METHOD_UNKNOWN;
- self->_priv.bearer = mm_modem_simple_connect_finish (simple_iface, res, &error);
+ MMBearer *bearer = mm_modem_simple_connect_finish (simple_iface, res, &error);
+
+ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+ return;
+
+ ctx = self->_priv.ctx;
if (!ctx)
return;
+ self->_priv.bearer = bearer;
+
if (!self->_priv.bearer) {
if (g_error_matches (error, MM_MOBILE_EQUIPMENT_ERROR, MM_MOBILE_EQUIPMENT_ERROR_SIM_PIN) ||
(g_error_matches (error, MM_CORE_ERROR, MM_CORE_ERROR_UNAUTHORIZED) &&
@@ -619,7 +626,7 @@ connect_context_step (NMModemBroadband *self)
mm_modem_simple_connect (self->_priv.simple_iface,
ctx->connect_properties,
- NULL,
+ ctx->cancellable,
(GAsyncReadyCallback) connect_ready,
self);
break;