diff options
author | Denis Kenzior <denkenz@gmail.com> | 2010-04-27 14:48:11 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2010-04-28 17:27:32 -0500 |
commit | 204814da058b7e6ee9ce00a26a03105853968e79 (patch) | |
tree | 623404691ffa77bf76af0906173ef6d9bf30c744 /gatchat/gatio.c | |
parent | c614254ae994a54dca564ca120e5602557f0b707 (diff) | |
download | ofono-204814da058b7e6ee9ce00a26a03105853968e79.tar.bz2 |
gatio: Get re-entrancy correct
Diffstat (limited to 'gatchat/gatio.c')
-rw-r--r-- | gatchat/gatio.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gatchat/gatio.c b/gatchat/gatio.c index 55a58491..63bfd827 100644 --- a/gatchat/gatio.c +++ b/gatchat/gatio.c @@ -61,11 +61,10 @@ static void read_watcher_destroy_notify(gpointer user_data) io->channel = NULL; io->read_watch = 0; - if (io->user_disconnect) - io->user_disconnect(io->user_disconnect_data); - if (io->destroyed) g_free(io); + else if (io->user_disconnect) + io->user_disconnect(io->user_disconnect_data); } static gboolean received_data(GIOChannel *channel, GIOCondition cond, @@ -239,6 +238,10 @@ gboolean g_at_io_shutdown(GAtIO *io) if (io->channel == NULL) return FALSE; + /* Don't trigger user disconnect on shutdown */ + io->user_disconnect = NULL; + io->user_disconnect_data = NULL; + if (io->read_watch > 0) g_source_remove(io->read_watch); |