plugins: Fix allowed apn plugin exit

This commit is contained in:
Nishanth V 2016-05-26 14:39:48 +05:30 committed by Denis Kenzior
parent 1cab1d554d
commit ff7837b054
1 changed files with 9 additions and 6 deletions

View File

@ -32,7 +32,6 @@
#define OFONO_API_SUBJECT_TO_CHANGE
#include <ofono/plugin.h>
#include <ofono/log.h>
#include <ofono/modem.h>
#include <ofono/sim.h>
#include <ofono/dbus.h>
@ -43,6 +42,7 @@
#define ALLOWED_ACCESS_POINTS_INTERFACE "org.ofono.AllowedAccessPoints"
guint modemwatch_id;
GSList *context_list;
struct allowed_apns_ctx {
guint simwatch_id;
@ -54,8 +54,6 @@ struct allowed_apns_ctx {
DBusMessage *reply;
};
GSList *context_list;
static void context_destroy(gpointer data)
{
struct allowed_apns_ctx *ctx = data;
@ -71,8 +69,6 @@ static void context_destroy(gpointer data)
if (ctx->sim_context)
ofono_sim_context_free(ctx->sim_context);
context_list = g_slist_remove(context_list, ctx);
g_free(ctx);
}
@ -191,8 +187,15 @@ static void sim_watch(struct ofono_atom *atom,
struct allowed_apns_ctx *ctx = data;
if (cond == OFONO_ATOM_WATCH_CONDITION_UNREGISTERED) {
if (ctx->sim_context)
if (ctx->simwatch_id) {
ofono_sim_remove_state_watch(ctx->sim, ctx->simwatch_id);
ctx->simwatch_id = 0;
}
if (ctx->sim_context) {
ofono_sim_context_free(ctx->sim_context);
ctx->sim_context = NULL;
}
return;
}