diff options
author | Andrzej Zaborowski <andrew.zaborowski@intel.com> | 2010-05-07 02:26:48 +0200 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2010-05-10 15:26:09 -0500 |
commit | 018ee10f92a48ac278b4219c1cf51876155fd5da (patch) | |
tree | 8d7c53df1e8446c7ffe299e2ae679c7c0e466c14 | |
parent | 988750898e5a6d736dddd2dcef96f01ea15afd0f (diff) | |
download | ofono-018ee10f92a48ac278b4219c1cf51876155fd5da.tar.bz2 |
Fix: Don't remove wrong atoms
When the state goes from INSERTED to NOT PRESENT and we have not
advanced past the SIM PIN entry, we remove the pre_sim atoms.
Similarly, if we advanced past the SIM PIN stage and subsequently
removed the SIM, the pre_sim atom list should not be tampered with.
-rw-r--r-- | src/modem.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/modem.c b/src/modem.c index 8319702e..0d0cb2a6 100644 --- a/src/modem.c +++ b/src/modem.c @@ -1132,13 +1132,16 @@ static void modem_sim_ready(void *user, enum ofono_sim_state new_state) switch (new_state) { case OFONO_SIM_STATE_NOT_PRESENT: - remove_all_atoms(&modem->atoms); + if (modem->pre_sim_atoms != NULL) + remove_all_atoms(&modem->atoms); break; case OFONO_SIM_STATE_INSERTED: break; case OFONO_SIM_STATE_READY: - modem->pre_sim_atoms = modem->atoms; - modem->atoms = NULL; + if (modem->pre_sim_atoms == NULL) { + modem->pre_sim_atoms = modem->atoms; + modem->atoms = NULL; + } if (modem->driver->post_sim) modem->driver->post_sim(modem); |