[tracker] tracker-status: Make sure we allocate the GValue we use
- From: Martyn James Russell <mr src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker] tracker-status: Make sure we allocate the GValue we use
- Date: Mon, 7 Sep 2009 13:53:21 +0000 (UTC)
commit 482b5204ada185fe43fcbb32fc0bc454692ebe91
Author: Martyn Russell <martyn lanedo com>
Date: Mon Sep 7 14:51:05 2009 +0100
tracker-status: Make sure we allocate the GValue we use
src/tracker-utils/tracker-status.c | 24 ++++++++++++++++++------
1 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/src/tracker-utils/tracker-status.c b/src/tracker-utils/tracker-status.c
index 7dd2833..460c876 100644
--- a/src/tracker-utils/tracker-status.c
+++ b/src/tracker-utils/tracker-status.c
@@ -453,10 +453,12 @@ manager_miner_progress_cb (TrackerMinerManager *manager,
const gchar *status,
gdouble progress)
{
- GValue gvalue = { 0 };
+ GValue *gvalue;
+
+ gvalue = g_slice_new0 (GValue);
- g_value_init (&gvalue, G_TYPE_DOUBLE);
- g_value_set_double (&gvalue, progress);
+ g_value_init (gvalue, G_TYPE_DOUBLE);
+ g_value_set_double (gvalue, progress);
miner_print_state (miner_name, status, progress, TRUE, FALSE);
@@ -465,7 +467,7 @@ manager_miner_progress_cb (TrackerMinerManager *manager,
g_strdup (status));
g_hash_table_replace (miners_progress,
g_strdup (miner_name),
- &gvalue);
+ gvalue);
}
static void
@@ -473,7 +475,7 @@ manager_miner_paused_cb (TrackerMinerManager *manager,
const gchar *miner_name)
{
GValue *gvalue;
-
+
gvalue = g_hash_table_lookup (miners_progress, miner_name);
miner_print_state (miner_name,
@@ -498,6 +500,16 @@ manager_miner_resumed_cb (TrackerMinerManager *manager,
FALSE);
}
+static void
+miners_progress_destroy_notify (gpointer data)
+{
+ GValue *value;
+
+ value = data;
+ g_value_unset (value);
+ g_slice_free (GValue, value);
+}
+
gint
main (gint argc, gchar *argv[])
{
@@ -764,7 +776,7 @@ main (gint argc, gchar *argv[])
miners_progress = g_hash_table_new_full (g_str_hash,
g_str_equal,
(GDestroyNotify) g_free,
- (GDestroyNotify) g_value_unset);
+ (GDestroyNotify) miners_progress_destroy_notify);
miners_status = g_hash_table_new_full (g_str_hash,
g_str_equal,
(GDestroyNotify) g_free,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]