diff options
author | Denis Kenzior <denkenz@gmail.com> | 2010-04-27 22:46:46 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2010-04-28 17:27:35 -0500 |
commit | e088f3c2bb1c859d732af1bdfa46cc24120c97ab (patch) | |
tree | 1168354a70cc3541313fd58a901528ae932d6687 /gatchat/gatchat.c | |
parent | 0845dc3b5de3f697577750cda1d3c51dd01313e3 (diff) | |
download | ofono-e088f3c2bb1c859d732af1bdfa46cc24120c97ab.tar.bz2 |
gatchat: Don't try to cleanup twice
In case we get unrefed from the disconnect callback
Diffstat (limited to 'gatchat/gatchat.c')
-rw-r--r-- | gatchat/gatchat.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/gatchat/gatchat.c b/gatchat/gatchat.c index 39c9545f..f94605fc 100644 --- a/gatchat/gatchat.c +++ b/gatchat/gatchat.c @@ -270,8 +270,6 @@ static void chat_cleanup(GAtChat *chat) g_at_syntax_unref(chat->syntax); chat->syntax = NULL; - chat->io = NULL; - if (chat->terminator_list) { g_slist_foreach(chat->terminator_list, (GFunc)free_terminator, NULL); @@ -284,9 +282,9 @@ static void io_disconnect(gpointer user_data) { GAtChat *chat = user_data; - g_at_io_set_read_handler(chat->io, NULL, NULL); - g_at_io_unref(chat->io); chat_cleanup(chat); + g_at_io_unref(chat->io); + chat->io = NULL; if (chat->user_disconnect) chat->user_disconnect(chat->user_disconnect_data); @@ -926,13 +924,12 @@ void g_at_chat_unref(GAtChat *chat) if (is_zero == FALSE) return; - if (chat->write_watch) - g_source_remove(chat->write_watch); - - g_at_chat_suspend(chat); - - g_at_io_unref(chat->io); - chat_cleanup(chat); + if (chat->io) { + g_at_chat_suspend(chat); + g_at_io_unref(chat->io); + chat->io = NULL; + chat_cleanup(chat); + } if (chat->in_read_handler) chat->destroyed = TRUE; |