Mercurial > pidgin
changeset 26720:25e01fe7b732
Fix a couple of runtime-warnings when disconnecting a yahoo account.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Mon, 27 Apr 2009 17:49:36 +0000 |
parents | 882667b6794b |
children | 1ba4bbd3b0cd |
files | libpurple/protocols/yahoo/yahoo.c |
diffstat | 1 files changed, 23 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/yahoo/yahoo.c Mon Apr 27 17:34:57 2009 +0000 +++ b/libpurple/protocols/yahoo/yahoo.c Mon Apr 27 17:49:36 2009 +0000 @@ -2705,13 +2705,20 @@ } /* remove timeout */ - purple_timeout_remove(yd->yahoo_p2p_server_timeout_handle); - yd->yahoo_p2p_server_timeout_handle = 0; + if (yd->yahoo_p2p_server_timeout_handle) { + purple_timeout_remove(yd->yahoo_p2p_server_timeout_handle); + yd->yahoo_p2p_server_timeout_handle = 0; + } /* remove watcher and close p2p server */ - purple_input_remove(yd->yahoo_p2p_server_watcher); - close(yd->yahoo_local_p2p_server_fd); - yd->yahoo_local_p2p_server_fd = -1; + if (yd->yahoo_p2p_server_watcher) { + purple_input_remove(yd->yahoo_p2p_server_watcher); + yd->yahoo_p2p_server_watcher = 0; + } + if (yd->yahoo_local_p2p_server_fd >= 0) { + close(yd->yahoo_local_p2p_server_fd); + yd->yahoo_local_p2p_server_fd = -1; + } /* Add an Input Read event to the file descriptor */ p2p_data->input_event = purple_input_add(acceptfd, PURPLE_INPUT_READ, yahoo_p2p_read_pkt_cb, data); @@ -3769,13 +3776,20 @@ yahoo_c_leave(gc, 1); /* 1 = YAHOO_CHAT_ID */ purple_timeout_remove(yd->yahoo_p2p_timer); - if(yd->yahoo_p2p_server_timeout_handle != 0) + if(yd->yahoo_p2p_server_timeout_handle != 0) { purple_timeout_remove(yd->yahoo_p2p_server_timeout_handle); + yd->yahoo_p2p_server_timeout_handle = 0; + } /* close p2p server if it is waiting for a peer to connect */ - purple_input_remove(yd->yahoo_p2p_server_watcher); - close(yd->yahoo_local_p2p_server_fd); - yd->yahoo_local_p2p_server_fd = -1; + if (yd->yahoo_p2p_server_watcher) { + purple_input_remove(yd->yahoo_p2p_server_watcher); + yd->yahoo_p2p_server_watcher = 0; + } + if (yd->yahoo_local_p2p_server_fd >= 0) { + close(yd->yahoo_local_p2p_server_fd); + yd->yahoo_local_p2p_server_fd = -1; + } g_hash_table_destroy(yd->sms_carrier); g_hash_table_destroy(yd->peers);