Mercurial > pidgin.yaz
changeset 24117:b19a3458e6b2
merge of '59e2b9896f25e8517b3f0f4d742c143e6fccd6e0'
and 'c2b5d965f04a15ae8caa5262870b9feae90390d9'
author | Marcus Lundblad <ml@update.uu.se> |
---|---|
date | Thu, 25 Sep 2008 04:51:19 +0000 |
parents | 9564593d170c (diff) 1afb5c981a1f (current diff) |
children | 9dc25e7e9625 |
files | |
diffstat | 1 files changed, 25 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkimhtml.c Thu Sep 25 01:59:44 2008 +0000 +++ b/pidgin/gtkimhtml.c Thu Sep 25 04:51:19 2008 +0000 @@ -348,6 +348,9 @@ g_string_free (t->values, TRUE); g_free (t->children); } + if (t && t->image) { + t->image->imhtml = NULL; + } g_free (t); } } @@ -1958,7 +1961,6 @@ } } -/* this isn't used yet static void gtk_smiley_tree_remove (GtkSmileyTree *tree, GtkIMHtmlSmiley *smiley) { @@ -1974,7 +1976,7 @@ pos = strchr (t->values->str, *x); if (pos) - t = t->children [(int) pos - (int) t->values->str]; + t = t->children [(unsigned int) pos - (unsigned int) t->values->str]; else return; @@ -1985,8 +1987,6 @@ t->image = NULL; } } -*/ - static gint gtk_smiley_tree_lookup (GtkSmileyTree *tree, @@ -2046,6 +2046,25 @@ return 0; } +static void +gtk_imhtml_disassociate_smiley_foreach(gpointer key, gpointer value, + gpointer user_data) +{ + GtkSmileyTree *tree = (GtkSmileyTree *) value; + GtkIMHtmlSmiley *smiley = (GtkIMHtmlSmiley *) user_data; + gtk_smiley_tree_remove(tree, smiley); +} + +static void +gtk_imhtml_disassociate_smiley(GtkIMHtmlSmiley *smiley) +{ + if (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); + } +} + void gtk_imhtml_associate_smiley (GtkIMHtml *imhtml, const gchar *sml, @@ -5617,12 +5636,14 @@ smiley->smile = g_strdup(shortcut); smiley->hidden = hide; smiley->flags = flags; + smiley->imhtml = NULL; gtk_imhtml_smiley_reload(smiley); return smiley; } void gtk_imhtml_smiley_destroy(GtkIMHtmlSmiley *smiley) { + gtk_imhtml_disassociate_smiley(smiley); g_free(smiley->smile); g_free(smiley->file); if (smiley->icon)