pidgin: 0e779a37: Fix a crash in Jabber that I think happe...
markdoliner at pidgin.im
markdoliner at pidgin.im
Tue Apr 29 01:41:01 EDT 2008
-----------------------------------------------------------------
Revision: 0e779a37ee17a7bb7ad39bbe2b37eeca45975655
Ancestor: 88c654eb750d6ce8e3d23da8cccc0a2bd93c8107
Author: markdoliner at pidgin.im
Date: 2008-04-29T02:06:03
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/0e779a37ee17a7bb7ad39bbe2b37eeca45975655
Modified files:
libpurple/protocols/jabber/presence.c
ChangeLog:
Fix a crash in Jabber that I think happens someone someone signs off
immediately after your client requests capability info about them.
The callback is called and passed a reference to the old jbr, but the
jbr no longer exists.
-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/presence.c 2b0f7846f1356123376598e49a935328b8921248
+++ libpurple/protocols/jabber/presence.c 3d6aea9aced9358f7595e6fde9a28e959ba26caf
@@ -369,18 +369,30 @@ typedef struct _JabberPresenceCapabiliti
typedef struct _JabberPresenceCapabilities {
JabberStream *js;
- JabberBuddyResource *jbr;
+ JabberBuddy *jb;
char *from;
} JabberPresenceCapabilities;
static void jabber_presence_set_capabilities(JabberCapsClientInfo *info, gpointer user_data) {
JabberPresenceCapabilities *userdata = user_data;
+ JabberID *jid;
+ JabberBuddyResource *jbr;
GList *iter;
- if(userdata->jbr->caps)
- jabber_caps_free_clientinfo(userdata->jbr->caps);
- userdata->jbr->caps = info;
+ jid = jabber_id_new(userdata->from);
+ jbr = jabber_buddy_find_resource(userdata->jb, jid->resource);
+ jabber_id_free(jid);
+ if(!jbr) {
+ g_free(userdata->from);
+ g_free(userdata);
+ return;
+ }
+
+ if(jbr->caps)
+ jabber_caps_free_clientinfo(jbr->caps);
+ jbr->caps = info;
+
if (info) {
for(iter = info->features; iter; iter = g_list_next(iter)) {
if(!strcmp((const char*)iter->data, "http://jabber.org/protocol/commands")) {
@@ -741,7 +753,7 @@ void jabber_presence_parse(JabberStream
if(node && ver) {
JabberPresenceCapabilities *userdata = g_new0(JabberPresenceCapabilities, 1);
userdata->js = js;
- userdata->jbr = jbr;
+ userdata->jb = jb;
userdata->from = g_strdup(from);
jabber_caps_get_info(js, from, node, ver, ext, jabber_presence_set_capabilities, userdata);
}
More information about the Commits
mailing list