# HG changeset patch # User Marcus Lundblad # Date 1225744598 0 # Node ID 4acda11bf672b9357f88c2f0024a9aead5f6f9af # Parent 260c6f4e6563e7103071c880e4aa78d44e68f847 Don't try to remove GtkIMHtmlSmileys from smiley trees if the GtkIMHtml that the smiley refers to doesn't exist anymore. Yes, I know this is a bit hacky, but I couldn't find another obvious way to do it without adding stuff in gtksmiley.c... diff -r 260c6f4e6563 -r 4acda11bf672 pidgin/gtkimhtml.c --- a/pidgin/gtkimhtml.c Sun Nov 02 22:56:42 2008 +0000 +++ b/pidgin/gtkimhtml.c Mon Nov 03 20:36:38 2008 +0000 @@ -2045,6 +2045,29 @@ return 0; } +/* a hack-around to prevent trying to doing gtk_smiley_tree_remove on a + GtkIMHtml that no longer lives... I know this is ugly, but I couldn't find + a better way to handle it for now, since there lives a list GtkIMHtmlSmileys + in gtksmiley.c and those can end up having dangling imhtml pointers */ +static gboolean +gtk_imhtml_is_alive(const GtkIMHtml *imhtml) +{ + GList *convs; + + for (convs = purple_get_conversations() ; convs != NULL ; + convs = g_list_next(convs)) { + PurpleConversation *conv = (PurpleConversation *) convs->data; + + if (PIDGIN_IS_PIDGIN_CONVERSATION(conv)) { + if (GTK_IMHTML(PIDGIN_CONVERSATION(conv)->imhtml) == imhtml + || GTK_IMHTML(PIDGIN_CONVERSATION(conv)->entry) == imhtml) { + return TRUE; + } + } + } + return FALSE; +} + static void gtk_imhtml_disassociate_smiley_foreach(gpointer key, gpointer value, gpointer user_data) @@ -2057,10 +2080,11 @@ static void gtk_imhtml_disassociate_smiley(GtkIMHtmlSmiley *smiley) { - if (smiley->imhtml) { + if (smiley->imhtml && gtk_imhtml_is_alive(smiley->imhtml)) { gtk_smiley_tree_remove(smiley->imhtml->default_smilies, smiley); g_hash_table_foreach(smiley->imhtml->smiley_data, gtk_imhtml_disassociate_smiley_foreach, smiley); + smiley->imhtml = NULL; } }