changeset 13479:90740e70af91

[gaim-migrate @ 15855] Patch from sadrul, expanded a bit by me, which fixes a crash when an MSN account disconnects while an msn_get_info() request is in progress and then completes after the disconnection. (Patch #1446189) committer: Tailor Script <tailor@pidgin.im>
author Evan Schoenberg <evan.s@dreskin.net>
date Thu, 09 Mar 2006 15:44:08 +0000
parents 38dcde2c8c4b
children ff06120eaf1e
files src/protocols/msn/msn.c
diffstat 1 files changed, 27 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/msn/msn.c	Thu Mar 09 06:26:16 2006 +0000
+++ b/src/protocols/msn/msn.c	Thu Mar 09 15:44:08 2006 +0000
@@ -1452,6 +1452,15 @@
 
 	gaim_debug_info("msn", "In msn_got_info\n");
 
+	/* Make sure the connection is still valid */
+	if (g_list_find(gaim_connections_get_all(), info_data->gc) == NULL)
+	{
+		gaim_debug_warning("msn", "invalid connection. ignoring buddy info.\n");
+		g_free(info_data->name);
+		g_free(info_data);
+		return;
+	}
+
 	tooltip_text = msn_tooltip_info_text(info_data);
 	title = _("MSN Profile");
 
@@ -1862,6 +1871,24 @@
 	char *photo_url_text = info2_data->photo_url_text;
 	char *tooltip_text = info2_data->tooltip_text;
 
+	/* Make sure the connection is still valid if we got here by fetching a photo url */
+	if (url_text &&
+		g_list_find(gaim_connections_get_all(), info_data->gc) == NULL)
+	{
+		gaim_debug_warning("msn", "invalid connection. ignoring buddy photo info.\n");
+		g_free(stripped);
+		g_free(url_buffer);
+		g_string_free(s, TRUE);
+		g_free(tooltip_text);
+		g_free(info_data->name);
+		g_free(info_data);
+#if PHOTO_SUPPORT
+		g_free(photo_url_text);
+		g_free(info2_data);
+#endif		
+		return;
+	}
+
 	/* Try to put the photo in there too, if there's one and is readable */
 	if (data && url_text && len != 0)
 	{