From 204814da058b7e6ee9ce00a26a03105853968e79 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Tue, 27 Apr 2010 14:48:11 -0500 Subject: gatio: Get re-entrancy correct --- gatchat/gatio.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'gatchat/gatio.c') 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); -- cgit v1.2.3