[empathy] smiley-manager: clean up memory management of the path
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] smiley-manager: clean up memory management of the path
- Date: Wed, 24 Nov 2010 12:53:15 +0000 (UTC)
commit 69afcc40e1fb02956b8ee0fad404b9afc776f64e
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Wed Nov 24 12:05:59 2010 +0100
smiley-manager: clean up memory management of the path
libempathy-gtk/empathy-smiley-manager.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/libempathy-gtk/empathy-smiley-manager.c b/libempathy-gtk/empathy-smiley-manager.c
index f344745..a589d30 100644
--- a/libempathy-gtk/empathy-smiley-manager.c
+++ b/libempathy-gtk/empathy-smiley-manager.c
@@ -39,7 +39,7 @@ typedef struct {
struct _SmileyManagerTree {
gunichar c;
GdkPixbuf *pixbuf;
- const gchar *path;
+ gchar *path;
GSList *childrens;
};
@@ -78,6 +78,7 @@ smiley_manager_tree_free (SmileyManagerTree *tree)
g_object_unref (tree->pixbuf);
}
g_slist_free (tree->childrens);
+ g_free (tree->path);
g_slice_free (SmileyManagerTree, tree);
}
@@ -209,13 +210,13 @@ smiley_manager_tree_insert (SmileyManagerTree *tree,
}
child->pixbuf = g_object_ref (pixbuf);
- child->path = path;
+ child->path = g_strdup (path);
}
static void
smiley_manager_add_valist (EmpathySmileyManager *manager,
GdkPixbuf *pixbuf,
- gchar *path,
+ const gchar *path,
const gchar *first_str,
va_list var_args)
{
@@ -227,7 +228,6 @@ smiley_manager_add_valist (EmpathySmileyManager *manager,
smiley_manager_tree_insert (priv->tree, pixbuf, str, path);
}
- /* We give the ownership of path to the smiley */
g_object_set_data_full (G_OBJECT (pixbuf), "smiley_str",
g_strdup (first_str), g_free);
smiley = smiley_new (pixbuf, first_str);
@@ -256,6 +256,7 @@ empathy_smiley_manager_add (EmpathySmileyManager *manager,
smiley_manager_add_valist (manager, pixbuf, path, first_str, var_args);
va_end (var_args);
g_object_unref (pixbuf);
+ g_free (path);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]