From 1f8e221a21119a95c8975fa30044d34b35c25b32 Mon Sep 17 00:00:00 2001 From: Stefan Becker Date: Sat, 1 Sep 2012 00:46:36 +0300 Subject: [PATCH] telepathy: fix crash from read_completed during flush When a transport has the do_flush flag set then none of the outstanding async operations gets cancelled, because they all share the same cancel object. So it can happen that read_completed is called when the SIPE core has already been deallocated. Simply ignore the read result in this case. --- src/telepathy/telepathy-transport.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/telepathy/telepathy-transport.c b/src/telepathy/telepathy-transport.c index 801df325..9a625196 100644 --- a/src/telepathy/telepathy-transport.c +++ b/src/telepathy/telepathy-transport.c @@ -91,6 +91,10 @@ static void read_completed(GObject *stream, SIPE_DEBUG_ERROR_NOFORMAT("read_completed: server has disconnected"); transport->error(conn, _("Server has disconnected")); return; + } else if (transport->do_flush) { + /* read completed while disconnected transport is flushing */ + SIPE_DEBUG_INFO_NOFORMAT("read_completed: ignored during flushing"); + return; } else if (g_cancellable_is_cancelled(transport->cancel)) { /* read completed when transport was disconnected */ SIPE_DEBUG_INFO_NOFORMAT("read_completed: cancelled"); -- 2.11.4.GIT