Skip to content

Commit

Permalink
Merge pull request #125 from alfonsosanchezbeato/fix-off-on-crash
Browse files Browse the repository at this point in the history
voicecall: Take notice of SIM removal
  • Loading branch information
tonyespy committed Oct 10, 2014
2 parents dcb459c + c773201 commit 8d7f5b8
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/voicecall.c
Original file line number Diff line number Diff line change
Expand Up @@ -2819,6 +2819,18 @@ static void read_sim_ecc_numbers(int id, void *userdata)
ecc_g3_read_cb, vc);
}

/*
* When this function is called context is being destroyed from SIM. So we mark
* it as such in voicecall data. This happens when the SIM atom is destroyed,
* and we need to know because it can be re-created later and we will need to
* create a new sim context.
*/
static void ecc_watch_destroy(void *userdata)
{
struct ofono_voicecall *vc = userdata;
vc->sim_context = NULL;
}

static void sim_state_watch(enum ofono_sim_state new_state, void *user)
{
struct ofono_voicecall *vc = user;
Expand All @@ -2831,7 +2843,8 @@ static void sim_state_watch(enum ofono_sim_state new_state, void *user)
read_sim_ecc_numbers(SIM_EFECC_FILEID, vc);

ofono_sim_add_file_watch(vc->sim_context, SIM_EFECC_FILEID,
read_sim_ecc_numbers, vc, NULL);
read_sim_ecc_numbers, vc,
ecc_watch_destroy);
break;
case OFONO_SIM_STATE_NOT_PRESENT:
case OFONO_SIM_STATE_RESETTING:
Expand Down

0 comments on commit 8d7f5b8

Please sign in to comment.