pidgin: 563dd65d: Be a bit more specific about removing no...
qulogic at pidgin.im
qulogic at pidgin.im
Fri Sep 2 15:55:47 EDT 2011
----------------------------------------------------------------------
Revision: 563dd65de5943f4fc7591a0db23ec411c545169e
Parent: 75ec74edcc85a4e376ccf3c424deb66d64db6ba9
Author: qulogic at pidgin.im
Date: 09/02/11 15:50:58
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/563dd65de5943f4fc7591a0db23ec411c545169e
Changelog:
Be a bit more specific about removing non-local MSN objects, which
HanzZ thinks should fix a leak somewhere.
Changes against parent 75ec74edcc85a4e376ccf3c424deb66d64db6ba9
patched libpurple/protocols/msn/msg.c
patched libpurple/protocols/msn/msn.c
patched libpurple/protocols/msn/object.c
patched libpurple/protocols/msn/object.h
patched libpurple/protocols/msn/slpcall.c
patched libpurple/protocols/msn/user.c
-------------- next part --------------
============================================================
--- libpurple/protocols/msn/msn.c 49f34d01a62cb83188020f3e663f534fff1d4ec4
+++ libpurple/protocols/msn/msn.c 6667e21b5e290953cad0caa986c8eb834f6bcc56
@@ -1453,7 +1453,7 @@ static void msn_emoticon_destroy(MsnEmot
static void msn_emoticon_destroy(MsnEmoticon *emoticon)
{
if (emoticon->obj)
- msn_object_destroy(emoticon->obj);
+ msn_object_destroy(emoticon->obj, FALSE);
g_free(emoticon->smile);
g_free(emoticon);
}
============================================================
--- libpurple/protocols/msn/msg.c 94fe3963ccab9a56f0311277c241efbc0242a4d6
+++ libpurple/protocols/msn/msg.c 2a76bc96aa6f5db741088e1d6755f908019cb2f8
@@ -970,7 +970,7 @@ void msn_emoticon_msg(MsnCmdProc *cmdpro
msn_slplink_request_object(slplink, smile, got_emoticon, NULL, obj);
}
- msn_object_destroy(obj);
+ msn_object_destroy(obj, FALSE);
obj = NULL;
who = NULL;
sha1 = NULL;
@@ -1025,7 +1025,7 @@ msn_datacast_msg(MsnCmdProc *cmdproc, Ms
slplink = msn_session_get_slplink(session, who);
msn_slplink_request_object(slplink, data, got_wink_cb, NULL, obj);
- msn_object_destroy(obj);
+ msn_object_destroy(obj, FALSE);
} else if (!strcmp(id, "3")) {
@@ -1045,7 +1045,7 @@ msn_datacast_msg(MsnCmdProc *cmdproc, Ms
slplink = msn_session_get_slplink(session, who);
msn_slplink_request_object(slplink, data, got_voiceclip_cb, NULL, obj);
- msn_object_destroy(obj);
+ msn_object_destroy(obj, FALSE);
} else if (!strcmp(id, "4")) {
/* Action */
============================================================
--- libpurple/protocols/msn/user.c a54b35fc805133d94ee8e7ad16293ff3b644de8e
+++ libpurple/protocols/msn/user.c 3e245a94e3db64d5eeb3943788fdf9af3c7f91ef
@@ -76,7 +76,7 @@ msn_user_destroy(MsnUser *user)
}
if (user->msnobj != NULL)
- msn_object_destroy(user->msnobj);
+ msn_object_destroy(user->msnobj, FALSE);
g_free(user->passport);
g_free(user->friendly_name);
@@ -588,8 +588,8 @@ msn_user_set_object(MsnUser *user, MsnOb
{
g_return_if_fail(user != NULL);
- if (user->msnobj != NULL && !msn_object_find_local(msn_object_get_sha1(obj)))
- msn_object_destroy(user->msnobj);
+ if (user->msnobj != NULL)
+ msn_object_destroy(user->msnobj, TRUE);
user->msnobj = obj;
============================================================
--- libpurple/protocols/msn/object.c 6b22e0106c25a790cf9b997ba57ba326d285751b
+++ libpurple/protocols/msn/object.c 543caec73eba08c01cd096480e4b5efbfe32b56f
@@ -103,7 +103,7 @@ msn_object_new_from_string(const char *s
if (obj->creator == NULL || obj->size == 0 || obj->type == 0
|| obj->sha1d == NULL) {
purple_debug_error("msn", "Discarding invalid msnobj: '%s'\n", str);
- msn_object_destroy(obj);
+ msn_object_destroy(obj, FALSE);
return NULL;
}
@@ -111,12 +111,12 @@ msn_object_new_from_string(const char *s
/* Location/friendly are required for non-buddyicon objects */
if (obj->type != MSN_OBJECT_USERTILE) {
purple_debug_error("msn", "Discarding invalid msnobj: '%s'\n", str);
- msn_object_destroy(obj);
+ msn_object_destroy(obj, FALSE);
return NULL;
/* Buddy icon object can contain Url/Url1 instead */
} else if (obj->url == NULL || obj->url1 == NULL) {
purple_debug_error("msn", "Discarding invalid msnobj: '%s'\n", str);
- msn_object_destroy(obj);
+ msn_object_destroy(obj, FALSE);
return NULL;
}
}
@@ -193,10 +193,13 @@ void
}
void
-msn_object_destroy(MsnObject *obj)
+msn_object_destroy(MsnObject *obj, gboolean only_remote)
{
g_return_if_fail(obj != NULL);
+ if (only_remote && obj->local)
+ return;
+
g_free(obj->creator);
g_free(obj->location);
g_free(obj->friendly);
============================================================
--- libpurple/protocols/msn/object.h 5ca32b4557df44c385c09545653b2ff2559b1b2b
+++ libpurple/protocols/msn/object.h e883c365a98d74b5a96600cb1aef2967c9f3695a
@@ -86,9 +86,10 @@ MsnObject *msn_object_new_from_image(Pur
/**
* Destroys an MsnObject structure.
*
- * @param obj The object structure.
+ * @param obj The object structure.
+ * @param only_remote Only destroy non-local objects.
*/
-void msn_object_destroy(MsnObject *obj);
+void msn_object_destroy(MsnObject *obj, gboolean only_remote);
/**
* Outputs a string representation of an MsnObject.
============================================================
--- libpurple/protocols/msn/slpcall.c 81222090de971b50bbcd46307830a333c68ac231
+++ libpurple/protocols/msn/slpcall.c 2c283879037cc63c220d019b5ae7962ea20a316d
@@ -485,7 +485,7 @@ got_sessionreq(MsnSlpCall *slpcall, cons
if (img)
purple_imgstore_ref(img);
}
- msn_object_destroy(obj);
+ msn_object_destroy(obj, FALSE);
if (img != NULL) {
/* DATA PREP */
More information about the Commits
mailing list