summaryrefslogtreecommitdiff
path: root/service/dconf-writer.c
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2012-11-08 13:42:21 -0500
committerRyan Lortie <desrt@desrt.ca>2012-11-08 13:44:05 -0500
commitf24c3410b68e57f2f330e209852de47a5145b6df (patch)
treeba70106092bc45c115dfa82cee7f08c7a6da22b8 /service/dconf-writer.c
parent4fce559d81bdd3841cfe16fd3a3e6b8e6e9e60f2 (diff)
downloaddconf-f24c3410b68e57f2f330e209852de47a5145b6df.tar.gz
service: fix some leaks in the writer
Also, slightly change the rules about begin/change/commit/end. It used to be theoretically possible to call: begin(), change(), commit(), change(), end(). but that is no longer supported (and it was never used anyway). Now the only valid thing to do after a commit() is end().
Diffstat (limited to 'service/dconf-writer.c')
-rw-r--r--service/dconf-writer.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/service/dconf-writer.c b/service/dconf-writer.c
index f4275ca..7e9a539 100644
--- a/service/dconf-writer.c
+++ b/service/dconf-writer.c
@@ -195,7 +195,7 @@ dconf_writer_real_begin (DConfWriter *writer,
if (value != NULL)
{
dconf_changeset_set (writer->commited_values, names[i], value);
- names[i] = NULL;
+ g_variant_unref (value);
}
}
@@ -217,6 +217,8 @@ dconf_writer_real_change (DConfWriter *writer,
DConfChangeset *changeset,
const gchar *tag)
{
+ g_return_if_fail (writer->uncommited_values != NULL);
+
dconf_changeset_change (writer->uncommited_values, changeset);
if (tag)
@@ -251,21 +253,24 @@ static gboolean
dconf_writer_real_commit (DConfWriter *writer,
GError **error)
{
- GHashTable *gvdb;
gboolean success;
- gvdb = gvdb_hash_table_new (NULL, NULL);
-
- dconf_changeset_all (writer->uncommited_values, dconf_writer_add_to_gvdb, gvdb);
+ {
+ GHashTable *gvdb;
- success = gvdb_table_write_contents (gvdb, writer->filename, FALSE, error);
+ gvdb = gvdb_hash_table_new (NULL, NULL);
+ dconf_changeset_all (writer->uncommited_values, dconf_writer_add_to_gvdb, gvdb);
+ success = gvdb_table_write_contents (gvdb, writer->filename, FALSE, error);
+ g_hash_table_unref (gvdb);
+ }
if (success && writer->native)
dconf_shm_flag (writer->name);
if (writer->commited_values)
dconf_changeset_unref (writer->commited_values);
- writer->commited_values = dconf_changeset_ref (writer->uncommited_values);
+ writer->commited_values = writer->uncommited_values;
+ writer->uncommited_values = NULL;
{
GQueue empty_queue = G_QUEUE_INIT;
@@ -386,6 +391,7 @@ dconf_writer_handle_change (DConfDBusWriter *dbus_writer,
goto out;
dconf_writer_change (writer, changeset, tag);
+ dconf_changeset_unref (changeset);
if (!dconf_writer_commit (writer, &error))
goto out;