wwan: cancel asyncronous request in connect_context_clear()

priv->ctx->cancellable is passed to mm_sim_send_pin() to cancel the
operation.

We must cancel the operation when the context/response is no longer
relevant.

Especially, as we don't take a reference on @self during the asyncronous
request.
This commit is contained in:
Thomas Haller 2016-05-12 10:52:20 +02:00
parent eede9a7c78
commit 80a2b27da9

View file

@ -288,7 +288,7 @@ connect_context_clear (NMModemBroadband *self)
g_clear_error (&ctx->first_error);
g_clear_pointer (&ctx->ip_types, (GDestroyNotify) g_array_unref);
g_clear_object (&ctx->cancellable);
nm_clear_g_cancellable (&ctx->cancellable);
g_clear_object (&ctx->connection);
g_clear_object (&ctx->connect_properties);
g_clear_object (&ctx->self);
@ -389,7 +389,7 @@ send_pin_ready (MMSim *sim, GAsyncResult *result, NMModemBroadband *self)
return;
if (!self->priv->ctx || self->priv->ctx->step != CONNECT_STEP_UNLOCK)
return;
g_return_if_reached ();
if (error) {
if (g_error_matches (error, MM_MOBILE_EQUIPMENT_ERROR, MM_MOBILE_EQUIPMENT_ERROR_SIM_PIN) ||