mirror of git://git.sysmocom.de/ofono
allowed-apns: Fix crash
When a modem is being removed, all of the modem's atom watches have already been cleaned up. Trying to remove it again results in a crash. Fix by registering a destroy callback which will be notified when the atomwatch has been removed.
This commit is contained in:
parent
ff7837b054
commit
f420aea458
|
@ -72,6 +72,13 @@ static void context_destroy(gpointer data)
|
||||||
g_free(ctx);
|
g_free(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void atomwatch_destroy(gpointer data)
|
||||||
|
{
|
||||||
|
struct allowed_apns_ctx *ctx = data;
|
||||||
|
|
||||||
|
ctx->atomwatch_id = 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void sim_acl_read_cb(int ok, int total_length, int record,
|
static void sim_acl_read_cb(int ok, int total_length, int record,
|
||||||
const unsigned char *data, int record_length,
|
const unsigned char *data, int record_length,
|
||||||
void *userdata)
|
void *userdata)
|
||||||
|
@ -246,7 +253,8 @@ static void modem_watch(struct ofono_modem *modem,
|
||||||
|
|
||||||
ctx->atomwatch_id = __ofono_modem_add_atom_watch(ctx->modem,
|
ctx->atomwatch_id = __ofono_modem_add_atom_watch(ctx->modem,
|
||||||
OFONO_ATOM_TYPE_SIM,
|
OFONO_ATOM_TYPE_SIM,
|
||||||
sim_watch, ctx, NULL);
|
sim_watch, ctx,
|
||||||
|
atomwatch_destroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void call_modemwatch(struct ofono_modem *modem, void *userdata)
|
static void call_modemwatch(struct ofono_modem *modem, void *userdata)
|
||||||
|
|
Loading…
Reference in New Issue