pidgin: 59e2b989: Clean up the GtkSmileyTrees on active Gt...
malu at pidgin.im
malu at pidgin.im
Thu Sep 25 00:55:29 EDT 2008
-----------------------------------------------------------------
Revision: 59e2b9896f25e8517b3f0f4d742c143e6fccd6e0
Ancestor: 6f5339668b310efa60c047d0ee4613ccc6454bfb
Author: malu at pidgin.im
Date: 2008-09-25T04:49:44
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/59e2b9896f25e8517b3f0f4d742c143e6fccd6e0
Modified files:
pidgin/gtkimhtml.c
ChangeLog:
Clean up the GtkSmileyTrees on active GtkIMHtml instances when a custom smiley
is deleted.
Closes #7159
-------------- next part --------------
============================================================
--- pidgin/gtkimhtml.c 183233379798b082b7877a1ecf0981d3128a3666
+++ pidgin/gtkimhtml.c 78cd8b8bf3967a49cdbedcd53036173d3dd5915f
@@ -348,6 +348,9 @@ gtk_smiley_tree_destroy (GtkSmileyTree *
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 @@ gtk_imhtml_link_drag_rcv_cb(GtkWidget *w
}
}
-/* this isn't used yet
static void gtk_smiley_tree_remove (GtkSmileyTree *tree,
GtkIMHtmlSmiley *smiley)
{
@@ -1974,7 +1976,7 @@ static void gtk_smiley_tree_remove (GtkS
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,9 +1987,7 @@ static void gtk_smiley_tree_remove (GtkS
t->image = NULL;
}
}
-*/
-
static gint
gtk_smiley_tree_lookup (GtkSmileyTree *tree,
const gchar *text)
@@ -2046,6 +2046,25 @@ gtk_smiley_tree_lookup (GtkSmileyTree *t
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 @@ GtkIMHtmlSmiley *gtk_imhtml_smiley_creat
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)
More information about the Commits
mailing list