pidgin: 57f4985c: Fix a couple of runtime-warnings when di...

sadrul at pidgin.im sadrul at pidgin.im
Mon Apr 27 23:46:03 EDT 2009


-----------------------------------------------------------------
Revision: 57f4985cff937a1ddd754153bbd9d5f3a34d1cc0
Ancestor: 8bec6c544cb0028f647fdfdfd57db8dee8129d88
Author: sadrul at pidgin.im
Date: 2009-04-27T17:49:36
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/57f4985cff937a1ddd754153bbd9d5f3a34d1cc0

Modified files:
        libpurple/protocols/yahoo/yahoo.c

ChangeLog: 

Fix a couple of runtime-warnings when disconnecting a yahoo account.

-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/yahoo.c	1cd635b22cb060bad8cfed066ba40856f959f275
+++ libpurple/protocols/yahoo/yahoo.c	c0395e8d1d608fee8c6109357b8d0873bf6f3abb
@@ -2705,13 +2705,20 @@ static void yahoo_p2p_server_send_connec
 	}
 
 	/* 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 @@ static void yahoo_close(PurpleConnection
 		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);


More information about the Commits mailing list