diff --git a/gatchat/gatmux.c b/gatchat/gatmux.c index d50e5361..4d89f039 100644 --- a/gatchat/gatmux.c +++ b/gatchat/gatmux.c @@ -653,13 +653,6 @@ 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) @@ -673,8 +666,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, - read_watcher_destroy_notify); + received_data, mux, NULL); mux->shutdown = FALSE; @@ -691,8 +683,10 @@ gboolean g_at_mux_shutdown(GAtMux *mux) if (mux->channel == NULL) return FALSE; - if (mux->read_watch > 0) + if (mux->read_watch > 0) { g_source_remove(mux->read_watch); + mux->read_watch = 0; + } if (mux->write_watch > 0) g_source_remove(mux->write_watch);