[dconf] writer: ignore empty changesets
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf] writer: ignore empty changesets
- Date: Mon, 11 Feb 2013 19:29:38 +0000 (UTC)
commit 214f6587aa8f454a44cf3bac5c8ae7ef9161326b
Author: Ryan Lortie <desrt desrt ca>
Date: Wed Jan 30 18:17:27 2013 +0100
writer: ignore empty changesets
When emitting change signals, we call dconf_changeset_describe() to
enumerate the keys to send the signal for.
When the changeset is empty, this function returns NULL for the path
vector. We pass that NULL into the signal emitter and the service
crashes.
We can avoid this situation by refusing to handle empty changesets in
the first place.
service/dconf-writer.c | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/service/dconf-writer.c b/service/dconf-writer.c
index 15801b5..b274ac9 100644
--- a/service/dconf-writer.c
+++ b/service/dconf-writer.c
@@ -209,8 +209,10 @@ dconf_writer_real_end (DConfWriter *writer)
TaggedChange *change = g_queue_pop_head (&writer->priv->commited_changes);
const gchar *prefix;
const gchar * const *paths;
+ guint n;
- dconf_changeset_describe (change->changeset, &prefix, &paths, NULL);
+ n = dconf_changeset_describe (change->changeset, &prefix, &paths, NULL);
+ g_assert (n != 0);
dconf_dbus_writer_emit_notify_signal (DCONF_DBUS_WRITER (writer), prefix, paths, change->tag);
dconf_changeset_unref (change->changeset);
g_free (change->tag);
@@ -298,16 +300,21 @@ dconf_writer_handle_change (DConfDBusWriter *dbus_writer,
tag = dconf_writer_get_tag (writer);
- if (!dconf_writer_begin (writer, &error))
- goto out;
+ /* Don't bother with empty changesets... */
+ if (dconf_changeset_describe (changeset, NULL, NULL, NULL))
+ {
+ if (!dconf_writer_begin (writer, &error))
+ goto out;
- dconf_writer_change (writer, changeset, tag);
- dconf_changeset_unref (changeset);
+ dconf_writer_change (writer, changeset, tag);
- if (!dconf_writer_commit (writer, &error))
- goto out;
+ if (!dconf_writer_commit (writer, &error))
+ goto out;
+ }
out:
+ dconf_changeset_unref (changeset);
+
if (error)
{
g_dbus_method_invocation_return_gerror (invocation, error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]