# HG changeset patch # User Mark Doliner # Date 1245778740 0 # Node ID 75aaadd295edeb6db75a1d654c3ffc7a30e35ed6 # Parent 4a62072ea83376a2374e12d820b380f3ee5f169f Stop the watchers before closing the fds diff -r 4a62072ea833 -r 75aaadd295ed libpurple/protocols/oscar/flap_connection.c --- a/libpurple/protocols/oscar/flap_connection.c Tue Jun 23 17:37:06 2009 +0000 +++ b/libpurple/protocols/oscar/flap_connection.c Tue Jun 23 17:39:00 2009 +0000 @@ -355,23 +355,9 @@ } } - if (conn->fd >= 0) - { - if (conn->type == SNAC_FAMILY_LOCATE) - flap_connection_send_close(od, conn); - - close(conn->fd); - conn->fd = -1; - } - - if (conn->gsc != NULL) - { - if (conn->type == SNAC_FAMILY_LOCATE) - flap_connection_send_close(od, conn); - - purple_ssl_close(conn->gsc); - conn->gsc = NULL; - } + if ((conn->fd >= 0 || conn->gsc != NULL) + && conn->type == SNAC_FAMILY_LOCATE) + flap_connection_send_close(od, conn); if (conn->watcher_incoming != 0) { @@ -385,6 +371,18 @@ conn->watcher_outgoing = 0; } + if (conn->fd >= 0) + { + close(conn->fd); + conn->fd = -1; + } + + if (conn->gsc != NULL) + { + purple_ssl_close(conn->gsc); + conn->gsc = NULL; + } + g_free(conn->buffer_incoming.data.data); conn->buffer_incoming.data.data = NULL;