# HG changeset patch # User Sadrul Habib Chowdhury # Date 1186986128 0 # Node ID ae0f058f604ec048cd8433d72647fb35e91f9c59 # Parent a0d45fa8ecfc670107439a60ddc7ca11bd4faedc Fix a crash regarding tooltips on the infopane. Steps to reproduce: Open a conversation, move the mouse and place it over the infopane, close the conversation window before the tooltip pops up. diff -r a0d45fa8ecfc -r ae0f058f604e pidgin/gtkconv.c --- a/pidgin/gtkconv.c Mon Aug 13 06:03:01 2007 +0000 +++ b/pidgin/gtkconv.c Mon Aug 13 06:22:08 2007 +0000 @@ -4411,13 +4411,32 @@ gtk_container_add(GTK_CONTAINER(sw), list); } -static int tooltip_timeout = 0; +/* Stuff used to display tooltips on the infopane */ +static struct { + int timeout; + PidginConversation *gtkconv; /* This is the Pidgin conversation that + triggered the tooltip */ +} tooltip; + +static void +reset_tooltip() +{ + if (tooltip.timeout != 0) { + g_source_remove(tooltip.timeout); + tooltip.timeout = 0; + } + tooltip.gtkconv = NULL; +} static gboolean pidgin_conv_tooltip_timeout(PidginConversation *gtkconv) { PurpleBlistNode *node = NULL; - PurpleConversation *conv = gtkconv->active_conv; + PurpleConversation *conv; + + g_return_val_if_fail (tooltip.gtkconv == gtkconv, FALSE); + + conv = gtkconv->active_conv; if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { node = (PurpleBlistNode*)(purple_blist_find_chat(conv->account, conv->name)); } else { @@ -4433,10 +4452,7 @@ pidgin_conv_leave_cb (GtkWidget *w, GdkEventCrossing *e, PidginConversation *gtkconv) { pidgin_blist_tooltip_destroy(); - if (tooltip_timeout) { - g_source_remove(tooltip_timeout); - tooltip_timeout = 0; - } + reset_tooltip(); } static gboolean @@ -4448,10 +4464,11 @@ if (delay == 0) return FALSE; - if (tooltip_timeout != 0) - g_source_remove(tooltip_timeout); - - tooltip_timeout = g_timeout_add(delay, (GSourceFunc)pidgin_conv_tooltip_timeout, gtkconv); + if (tooltip.timeout != 0) + g_source_remove(tooltip.timeout); + + tooltip.timeout = g_timeout_add(delay, (GSourceFunc)pidgin_conv_tooltip_timeout, gtkconv); + tooltip.gtkconv = gtkconv; return FALSE; } @@ -4985,6 +5002,9 @@ g_list_foreach(gtkconv->send_history, (GFunc)g_free, NULL); g_list_free(gtkconv->send_history); + if (tooltip.gtkconv == gtkconv) + reset_tooltip(); + g_free(gtkconv); }