From 4714d8199aacf0ba6be777a70e01b3016ba2aa5f Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Wed, 11 May 2011 12:09:56 -0500 Subject: gprs: Mark context inactive on removal --- src/gprs.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/gprs.c') diff --git a/src/gprs.c b/src/gprs.c index 6a3c44ec..0c709ad6 100644 --- a/src/gprs.c +++ b/src/gprs.c @@ -2133,12 +2133,38 @@ void ofono_gprs_set_cid_range(struct ofono_gprs *gprs, static void gprs_context_unregister(struct ofono_atom *atom) { struct ofono_gprs_context *gc = __ofono_atom_get_data(atom); + DBusConnection *conn = ofono_dbus_get_connection(); + GSList *l; + struct pri_context *ctx; + dbus_bool_t value; DBG("%p, %p", gc, gc->gprs); if (gc->gprs == NULL) goto done; + for (l = gc->gprs->contexts; l; l = l->next) { + ctx = l->data; + + if (ctx->context_driver != gc) + continue; + + if (ctx->pending != NULL) + __ofono_dbus_pending_reply(&ctx->pending, + __ofono_error_failed(ctx->pending)); + + if (ctx->active == FALSE) + break; + + pri_reset_context_settings(ctx); + release_context(ctx); + + value = FALSE; + ofono_dbus_signal_property_changed(conn, ctx->path, + OFONO_CONNECTION_CONTEXT_INTERFACE, + "Active", DBUS_TYPE_BOOLEAN, &value); + } + gc->gprs->context_drivers = g_slist_remove(gc->gprs->context_drivers, gc); gc->gprs = NULL; -- cgit v1.2.3