pidgin: e7b8f4ac: msn_message_destroy() calls msn_message_...

markdoliner at pidgin.im markdoliner at pidgin.im
Mon Nov 22 02:45:33 EST 2010


----------------------------------------------------------------------
Revision: e7b8f4acdba01f7f2e9c1a4163fc6d2bbefef2ec
Parent:   fe00f9786c65219ca9a113663801eb1df2bf3b15
Author:   markdoliner at pidgin.im
Date:     11/22/10 02:40:23
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/e7b8f4acdba01f7f2e9c1a4163fc6d2bbefef2ec

Changelog: 

msn_message_destroy() calls msn_message_unref() if refcount>0.  This is
always the case.  So change all code to call msn_message_unref() directly
and change msn_message_destroy to be a private function.  This should
be more clear.

Changes against parent fe00f9786c65219ca9a113663801eb1df2bf3b15

  patched  libpurple/protocols/msn/msg.c
  patched  libpurple/protocols/msn/msg.h
  patched  libpurple/protocols/msn/msn.c
  patched  libpurple/protocols/msn/notification.c
  patched  libpurple/protocols/msn/oim.c
  patched  libpurple/protocols/msn/sbconn.c
  patched  libpurple/protocols/msn/switchboard.c

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/msn.c	7df4ff74aa4d42f65b5596f4dcb57c521de35396
+++ libpurple/protocols/msn/msn.c	5f8a7aefc43c2148c3cca59097a3914518a2d8d1
@@ -132,7 +132,7 @@ msn_send_attention(PurpleConnection *gc,
 	swboard = msn_session_get_swboard(session, username, MSN_SB_FLAG_IM);
 
 	msn_switchboard_send_msg(swboard, msg, TRUE);
-	msn_message_destroy(msg);
+	msn_message_unref(msg);
 
 	return TRUE;
 }
@@ -1393,7 +1393,7 @@ msn_send_emoticons(MsnSwitchBoard *swboa
 	msn_message_set_bin_data(msg, body->str, body->len);
 
 	msn_switchboard_send_msg(swboard, msg, TRUE);
-	msn_message_destroy(msg);
+	msn_message_unref(msg);
 }
 
 static void msn_emoticon_destroy(MsnEmoticon *emoticon)
@@ -1582,7 +1582,7 @@ msn_send_im(PurpleConnection *gc, const 
 			purple_timeout_add(0, msn_send_me_im, imdata);
 		}
 
-		msn_message_destroy(msg);
+		msn_message_unref(msg);
 	} else {
 		/*send Offline Instant Message,only to MSN Passport User*/
 		char *friendname;
@@ -1646,7 +1646,7 @@ msn_send_typing(PurpleConnection *gc, co
 
 	msn_switchboard_send_msg(swboard, msg, FALSE);
 
-	msn_message_destroy(msg);
+	msn_message_unref(msg);
 
 	return MSN_TYPING_SEND_TIMEOUT;
 }
@@ -2072,7 +2072,7 @@ msn_chat_send(PurpleConnection *gc, int 
 	}
 
 	msn_switchboard_send_msg(swboard, msg, FALSE);
-	msn_message_destroy(msg);
+	msn_message_unref(msg);
 
 	g_free(msgformat);
 	g_free(msgtext);
============================================================
--- libpurple/protocols/msn/msg.c	dd9cf9291e148ae087fc8d09964ef2494d4f7312
+++ libpurple/protocols/msn/msg.c	7e630820b46c867cf25555a75a8a7f998de71002
@@ -50,18 +50,16 @@ msn_message_new(MsnMsgType type)
 	return msg;
 }
 
-void
+/**
+ * Destroys a message.
+ *
+ * @param msg The message to destroy.
+ */
+static void
 msn_message_destroy(MsnMessage *msg)
 {
 	g_return_if_fail(msg != NULL);
 
-	if (msg->ref_count > 0)
-	{
-		msn_message_unref(msg);
-
-		return;
-	}
-
 	if (purple_debug_is_verbose())
 		purple_debug_info("msn", "message destroy (%p)\n", msg);
 
@@ -1224,7 +1222,7 @@ msn_invite_msg(MsnCmdProc *cmdproc, MsnM
 			g_free(text);
 
 			msn_switchboard_send_msg(swboard, cancel, TRUE);
-			msn_message_destroy(cancel);
+			msn_message_unref(cancel);
 		}
 
 	} else if (!strcmp(command, "CANCEL")) {
============================================================
--- libpurple/protocols/msn/msg.h	5f8f22779ac286a456312dd62c14207fad5374e1
+++ libpurple/protocols/msn/msg.h	895d2f1b07866919e0faeb02190c0362e699edf5
@@ -171,13 +171,6 @@ void msn_message_parse_payload(MsnMessag
 						  const char *line_dem,const char *body_dem);
 
 /**
- * Destroys a message.
- *
- * @param msg The message to destroy.
- */
-void msn_message_destroy(MsnMessage *msg);
-
-/**
  * Increments the reference count on a message.
  *
  * @param msg The message.
============================================================
--- libpurple/protocols/msn/switchboard.c	1787991241f367c297a7a6d7fa22a588de78fc95
+++ libpurple/protocols/msn/switchboard.c	dc4011278d3b71546ed501d3e651fa7af5e16457
@@ -225,7 +225,7 @@ send_clientcaps(MsnSwitchBoard *swboard)
 
 	msn_switchboard_send_msg(swboard, msg, TRUE);
 
-	msn_message_destroy(msg);
+	msn_message_unref(msg);
 }
 
 static void
============================================================
--- libpurple/protocols/msn/notification.c	8991cf51fab03da5b5c8e995fed749ef1347efdd
+++ libpurple/protocols/msn/notification.c	1f205280a81a547dbfba11dcdfa69a5b959c8884
@@ -332,7 +332,7 @@ msg_cmd_post(MsnCmdProc *cmdproc, MsnCom
 
 	msn_cmdproc_process_msg(cmdproc, msg);
 
-	msn_message_destroy(msg);
+	msn_message_unref(msg);
 }
 
 static void
@@ -1210,7 +1210,7 @@ ipg_cmd_post(MsnCmdProc *cmdproc, MsnCom
 
 					g_free(body_str);
 					g_free(body_enc);
-					msn_message_destroy(msg);
+					msn_message_unref(msg);
 					trans->data = NULL;
 				}
 			}
============================================================
--- libpurple/protocols/msn/oim.c	65b79ef94144934e1d1e38094c0f8297fa8d4471
+++ libpurple/protocols/msn/oim.c	06534ce3edc89d75f3d6390e8666ba0b411805aa
@@ -641,10 +641,10 @@ msn_oim_report_to_user(MsnOimRecvData *r
 			type = msn_message_get_content_type(multipart);
 			if (type && !strcmp(type, "text/plain")) {
 				decode_msg = (char *)purple_base64_decode(multipart->body, &body_len);
-				msn_message_destroy(multipart);
+				msn_message_unref(multipart);
 				break;
 			}
-			msn_message_destroy(multipart);
+			msn_message_unref(multipart);
 		}
 
 		g_strfreev(tokens);
@@ -652,7 +652,7 @@ msn_oim_report_to_user(MsnOimRecvData *r
 
 		if (decode_msg == NULL) {
 			purple_debug_error("msn", "Couldn't find text/plain OIM message.\n");
-			msn_message_destroy(message);
+			msn_message_unref(message);
 			return;
 		}
 	} else {
@@ -708,7 +708,7 @@ msn_oim_report_to_user(MsnOimRecvData *r
 
 	g_free(passport);
 	g_free(decode_msg);
-	msn_message_destroy(message);
+	msn_message_unref(message);
 }
 
 /* Parse the XML data,
============================================================
--- libpurple/protocols/msn/sbconn.c	0d90c026f464b6d9632bffcb549204f46ac5f02c
+++ libpurple/protocols/msn/sbconn.c	f28975506a202a18967d66566f162fe388656ff5
@@ -33,7 +33,7 @@ void msn_sbconn_send_part(MsnSlpLink *sl
 	}
 
 	msn_switchboard_send_msg(slplink->swboard, msg, TRUE);
-	msn_message_destroy(msg);
+	msn_message_unref(msg);
 }
 
 /** Called when a message times out. */


More information about the Commits mailing list