device: fix crash by handling connection cancellation
This commit is contained in:

committed by
Thomas Haller

parent
7efc3c479f
commit
105ee6e5a9
@@ -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;
|
||||
|
Reference in New Issue
Block a user