mirror of git://git.sysmocom.de/ofono
sim: destroy spn info as part of sim main state
This commit is contained in:
parent
e98dcc0616
commit
454ca9f40e
74
src/sim.c
74
src/sim.c
|
@ -2316,6 +2316,42 @@ static void sim_free_early_state(struct ofono_sim *sim)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void sim_spn_close(struct ofono_sim *sim)
|
||||||
|
{
|
||||||
|
if (sim->spn_watches) {
|
||||||
|
__ofono_watchlist_free(sim->spn_watches);
|
||||||
|
sim->spn_watches = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We have not initialized SPN logic at all yet, either because
|
||||||
|
* no netreg / gprs atom has been needed or we have not reached the
|
||||||
|
* post_sim state
|
||||||
|
*/
|
||||||
|
if (sim->ef_spn_watch == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ofono_sim_remove_file_watch(sim->context, sim->ef_spn_watch);
|
||||||
|
sim->ef_spn_watch = 0;
|
||||||
|
|
||||||
|
ofono_sim_remove_file_watch(sim->context, sim->cphs_spn_watch);
|
||||||
|
sim->cphs_spn_watch = 0;
|
||||||
|
|
||||||
|
if (sim->cphs_spn_short_watch) {
|
||||||
|
ofono_sim_remove_file_watch(sim->context,
|
||||||
|
sim->cphs_spn_short_watch);
|
||||||
|
sim->cphs_spn_short_watch = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
sim->flags &= ~SIM_FLAG_READING_SPN;
|
||||||
|
|
||||||
|
g_free(sim->spn);
|
||||||
|
sim->spn = NULL;
|
||||||
|
|
||||||
|
g_free(sim->spn_dc);
|
||||||
|
sim->spn_dc = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static void sim_free_main_state(struct ofono_sim *sim)
|
static void sim_free_main_state(struct ofono_sim *sim)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -2384,6 +2420,8 @@ static void sim_free_main_state(struct ofono_sim *sim)
|
||||||
sim->fixed_dialing = FALSE;
|
sim->fixed_dialing = FALSE;
|
||||||
sim->barred_dialing = FALSE;
|
sim->barred_dialing = FALSE;
|
||||||
|
|
||||||
|
sim_spn_close(sim);
|
||||||
|
|
||||||
if (sim->context) {
|
if (sim->context) {
|
||||||
ofono_sim_context_free(sim->context);
|
ofono_sim_context_free(sim->context);
|
||||||
sim->context = NULL;
|
sim->context = NULL;
|
||||||
|
@ -2601,40 +2639,6 @@ static void sim_spn_init(struct ofono_sim *sim)
|
||||||
sim_spn_changed, sim, NULL);
|
sim_spn_changed, sim, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sim_spn_close(struct ofono_sim *sim)
|
|
||||||
{
|
|
||||||
__ofono_watchlist_free(sim->spn_watches);
|
|
||||||
sim->spn_watches = NULL;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* We have not initialized SPN logic at all yet, either because
|
|
||||||
* no netreg / gprs atom has been needed or we have not reached the
|
|
||||||
* post_sim state
|
|
||||||
*/
|
|
||||||
if (sim->ef_spn_watch == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ofono_sim_remove_file_watch(sim->context, sim->ef_spn_watch);
|
|
||||||
sim->ef_spn_watch = 0;
|
|
||||||
|
|
||||||
ofono_sim_remove_file_watch(sim->context, sim->cphs_spn_watch);
|
|
||||||
sim->cphs_spn_watch = 0;
|
|
||||||
|
|
||||||
if (sim->cphs_spn_short_watch) {
|
|
||||||
ofono_sim_remove_file_watch(sim->context,
|
|
||||||
sim->cphs_spn_short_watch);
|
|
||||||
sim->cphs_spn_short_watch = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
sim->flags &= ~SIM_FLAG_READING_SPN;
|
|
||||||
|
|
||||||
g_free(sim->spn);
|
|
||||||
sim->spn = NULL;
|
|
||||||
|
|
||||||
g_free(sim->spn_dc);
|
|
||||||
sim->spn_dc = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ofono_bool_t ofono_sim_add_spn_watch(struct ofono_sim *sim, unsigned int *id,
|
ofono_bool_t ofono_sim_add_spn_watch(struct ofono_sim *sim, unsigned int *id,
|
||||||
ofono_sim_spn_cb_t cb, void *data,
|
ofono_sim_spn_cb_t cb, void *data,
|
||||||
ofono_destroy_func destroy)
|
ofono_destroy_func destroy)
|
||||||
|
@ -2806,8 +2810,6 @@ static void sim_unregister(struct ofono_atom *atom)
|
||||||
__ofono_watchlist_free(sim->state_watches);
|
__ofono_watchlist_free(sim->state_watches);
|
||||||
sim->state_watches = NULL;
|
sim->state_watches = NULL;
|
||||||
|
|
||||||
sim_spn_close(sim);
|
|
||||||
|
|
||||||
g_dbus_unregister_interface(conn, path, OFONO_SIM_MANAGER_INTERFACE);
|
g_dbus_unregister_interface(conn, path, OFONO_SIM_MANAGER_INTERFACE);
|
||||||
ofono_modem_remove_interface(modem, OFONO_SIM_MANAGER_INTERFACE);
|
ofono_modem_remove_interface(modem, OFONO_SIM_MANAGER_INTERFACE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue