/pidgin/main: acdc2b82a743: Fix a crash when receiving message f...

Tomasz Wasilczyk tomkiewicz at cpw.pidgin.im
Sun Feb 10 21:49:22 EST 2013


Changeset: acdc2b82a7435a81c5ba2daf0655884dad67330e
Author:	 Tomasz Wasilczyk <tomkiewicz at cpw.pidgin.im>
Date:	 2013-02-11 03:49 +0100
Branch:	 default
URL: http://hg.pidgin.im/pidgin/main/rev/acdc2b82a743

Description:

Fix a crash when receiving message from another contact within already opened conversation with meta-contact

diffstat:

 pidgin/gtkconv.c |  8 ++++++--
 pidgin/gtkconv.h |  1 +
 2 files changed, 7 insertions(+), 2 deletions(-)

diffs (36 lines):

diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c
--- a/pidgin/gtkconv.c
+++ b/pidgin/gtkconv.c
@@ -6459,8 +6459,11 @@ pidgin_conv_write_conv(PurpleConversatio
 			PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_CONTENT);
 
 	} else if ((flags & PURPLE_MESSAGE_RECV) && (old_flags & PURPLE_MESSAGE_RECV)) {
-		GList *history = purple_conversation_get_message_history(conv);
-		PurpleConvMessage *last_msg = (PurpleConvMessage *)history->data;
+		GList *history = purple_conversation_get_message_history(gtkconv->last_conversed);
+		PurpleConvMessage *last_msg = history ? (PurpleConvMessage *)history->data : NULL;
+
+		g_assert(history != NULL);
+		g_assert(last_msg != NULL);
 
 		/* If the senders are the same, use appendNextMessage */
 		if (purple_strequal(purple_conversation_message_get_sender(last_msg), name)) {
@@ -6480,6 +6483,7 @@ pidgin_conv_write_conv(PurpleConversatio
 			PIDGIN_CONVERSATION_THEME_TEMPLATE_STATUS);
 	}
 	gtkconv->last_flags = flags;
+	gtkconv->last_conversed = conv;
 
 	smileyed = smiley_parse_markup(displaying, purple_account_get_protocol_id(account));
 	msg = replace_message_tokens(message_html, conv, name, alias, smileyed, flags, mtime);
diff --git a/pidgin/gtkconv.h b/pidgin/gtkconv.h
--- a/pidgin/gtkconv.h
+++ b/pidgin/gtkconv.h
@@ -83,6 +83,7 @@ enum {
 struct _PidginConversation
 {
 	PurpleConversation *active_conv;
+	PurpleConversation *last_conversed;
 	GList *convs;
 	GList *send_history;
 



More information about the Commits mailing list