[notification-daemon] Make sure to copy data into the stored hint hash
- From: William Jon McCann <mccann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [notification-daemon] Make sure to copy data into the stored hint hash
- Date: Fri, 15 Oct 2010 04:54:34 +0000 (UTC)
commit 9ed62a738e62effcaaaad23a2dfa5e19e2044872
Author: William Jon McCann <jmccann redhat com>
Date: Fri Oct 15 00:46:10 2010 -0400
Make sure to copy data into the stored hint hash
src/nd-notification.c | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/src/nd-notification.c b/src/nd-notification.c
index 2e50911..0910c55 100644
--- a/src/nd-notification.c
+++ b/src/nd-notification.c
@@ -112,6 +112,13 @@ nd_notification_class_init (NdNotificationClass *class)
G_TYPE_NONE, 1, G_TYPE_STRING);
}
+ static void
+_g_value_free (GValue *value)
+{
+ g_value_unset (value);
+ g_free (value);
+}
+
static void
nd_notification_init (NdNotification *notification)
{
@@ -122,7 +129,10 @@ nd_notification_init (NdNotification *notification)
notification->summary = NULL;
notification->body = NULL;
notification->actions = NULL;
- notification->hints = g_hash_table_new (g_str_hash, g_str_equal);
+ notification->hints = g_hash_table_new_full (g_str_hash,
+ g_str_equal,
+ g_free,
+ (GDestroyNotify) _g_value_free);
}
static void
@@ -181,7 +191,13 @@ nd_notification_update (NdNotification *notification,
g_hash_table_iter_init (&iter, hints);
while (g_hash_table_iter_next (&iter, &key, &value)) {
- g_hash_table_insert (notification->hints, key, value);
+ GValue *value_copy;
+
+ value_copy = g_new0 (GValue, 1);
+ g_value_init (value_copy, G_VALUE_TYPE (value));
+ g_value_copy (value, value_copy);
+
+ g_hash_table_insert (notification->hints, g_strdup (key), value_copy);
}
g_signal_emit (notification, signals[CHANGED], 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]