pidgin: 633ffe23: Don't try to remove GtkIMHtmlSmileys fro...
malu at pidgin.im
malu at pidgin.im
Mon Nov 3 15:40:33 EST 2008
-----------------------------------------------------------------
Revision: 633ffe234af48ead3631ae62e23840b4438fcf5f
Ancestor: 6c480ed0bfda22bc5131c6a0465140f17e3bf40c
Author: malu at pidgin.im
Date: 2008-11-03T20:36:38
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/633ffe234af48ead3631ae62e23840b4438fcf5f
Modified files:
pidgin/gtkimhtml.c
ChangeLog:
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...
-------------- next part --------------
============================================================
--- pidgin/gtkimhtml.c d4ea20324e2320a18c38544641d18de1fcc10a61
+++ pidgin/gtkimhtml.c 15cbdaed36b28411bf555ace284f51ad3bcf72ec
@@ -2045,6 +2045,29 @@ gtk_smiley_tree_lookup (GtkSmileyTree *t
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 @@ gtk_imhtml_disassociate_smiley(GtkIMHtml
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;
}
}
More information about the Commits
mailing list