changeset 19655:1729367f0a4f

Fix a crash when hovering over a buddy in the chat userlist and the account is disconnected.
author Daniel Atallah <daniel.atallah@gmail.com>
date Wed, 05 Sep 2007 23:51:16 +0000
parents 941965d6fd88
children 9cc67c3d145e 15cb06e2d387 301f1597d41f
files pidgin/gtkconv.c
diffstat 1 files changed, 18 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkconv.c	Wed Sep 05 22:33:22 2007 +0000
+++ b/pidgin/gtkconv.c	Wed Sep 05 23:51:16 2007 +0000
@@ -4497,12 +4497,12 @@
 pidgin_conv_motion_cb (GtkWidget *infopane, GdkEventMotion *event, PidginConversation *gtkconv)
 {
 	int delay = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/tooltip_delay");
-	
+
 	pidgin_blist_tooltip_destroy();
 	if (delay == 0)
 		return FALSE;
 
-	if (tooltip.timeout != 0) 
+	if (tooltip.timeout != 0)
 		g_source_remove(tooltip.timeout);
 
 	tooltip.timeout = g_timeout_add(delay, (GSourceFunc)pidgin_conv_tooltip_timeout, gtkconv);
@@ -4516,7 +4516,6 @@
 	PurplePluginProtocolInfo *prpl_info;
 	PurpleConversation *conv = gtkconv->active_conv;
 	PidginChatPane *gtkchat;
-	PurpleConnection *gc;
 	PurpleBlistNode *node = NULL;
 	PurpleAccount *account;
 	GtkTreePath *path;
@@ -4528,8 +4527,11 @@
 
 	gtkchat = gtkconv->u.chat;
 	account = purple_conversation_get_account(conv);
-	gc = account->gc;
-	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+
+	if (account->gc == NULL)
+		return FALSE;
+
+	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(account->gc->prpl);
 
 	model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list));
 
@@ -4543,7 +4545,7 @@
 	gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &who, -1);
 
 	node = (PurpleBlistNode*)(purple_find_buddy(conv->account, who));
-	if (node && prpl_info && (prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) 
+	if (node && prpl_info && (prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME))
 		pidgin_blist_draw_tooltip(node, gtkconv->infopane);
 
 	g_free(who);
@@ -4553,20 +4555,26 @@
 	return FALSE;
 }
 
-static gboolean 
+static gboolean
 pidgin_userlist_motion_cb (GtkWidget *w, GdkEventMotion *event, PidginConversation *gtkconv)
 {
 	PurpleConversation *conv;
+	PurpleAccount *account;
 	int delay = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/tooltip_delay");
 	
 	pidgin_blist_tooltip_destroy();
 	if (delay == 0)
 		return FALSE;
 
-	if (tooltip.timeout != 0) 
+	if (tooltip.timeout != 0)
 		g_source_remove(tooltip.timeout);
-	
+	tooltip.timeout = 0;
+
 	conv = gtkconv->active_conv;
+	account = purple_conversation_get_account(conv);
+
+	if (account->gc == NULL)
+		return FALSE;
 
 	tooltip.timeout = g_timeout_add(delay, (GSourceFunc)pidgin_userlist_tooltip_timeout, gtkconv);
 	tooltip.gtkconv = gtkconv;
@@ -4606,7 +4614,7 @@
 	gtk_widget_show(gtkconv->infopane_hbox);
 	gtk_widget_add_events(event_box,
 	                      GDK_POINTER_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK);
-	g_signal_connect(G_OBJECT(event_box), "button_press_event",
+	g_signal_connect(G_OBJECT(event_box), "button-press-event",
 	                 G_CALLBACK(infopane_press_cb), gtkconv);
 
 	g_signal_connect(G_OBJECT(event_box), "motion-notify-event",