diff options
author | Antoine Aubert <a.aubert@overkiz.com> | 2016-10-05 08:42:28 +0200 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2016-10-05 13:02:41 -0500 |
commit | da47398525bd86a3b2928aa986be5bd4d624a8c6 (patch) | |
tree | 81eac47229409ead2dc33f40ae266a88a45bc024 | |
parent | 54fb56df2413c960d1b73b83e2f1ae2392f21226 (diff) | |
download | ofono-da47398525bd86a3b2928aa986be5bd4d624a8c6.tar.gz |
gatmux: fix read channel remove on error
In case of invalid IO, read_watch is not reset. This fix crash on
destroy gatmux.
-rw-r--r-- | gatchat/gatmux.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gatchat/gatmux.c b/gatchat/gatmux.c index 9beeece3..074e340a 100644 --- a/gatchat/gatmux.c +++ b/gatchat/gatmux.c @@ -598,6 +598,13 @@ void g_at_mux_unref(GAtMux *mux) } } +static void read_watcher_destroy_notify(gpointer user_data) +{ + GAtMux *mux = user_data; + + mux->read_watch = 0; +} + gboolean g_at_mux_start(GAtMux *mux) { if (mux->channel == NULL) @@ -611,7 +618,7 @@ gboolean g_at_mux_start(GAtMux *mux) mux->read_watch = g_io_add_watch_full(mux->channel, G_PRIORITY_DEFAULT, G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL, - received_data, mux, NULL); + received_data, mux, read_watcher_destroy_notify); mux->shutdown = FALSE; |