diff options
author | Ryan Lortie <desrt@desrt.ca> | 2013-01-30 18:17:27 +0100 |
---|---|---|
committer | Ryan Lortie <desrt@desrt.ca> | 2013-02-11 13:15:34 -0500 |
commit | 214f6587aa8f454a44cf3bac5c8ae7ef9161326b (patch) | |
tree | d55edd17e72805c2526795895d79a4aa02685892 /service | |
parent | d0307c6cd66b1db6a712a53c30349b0b9b7e3087 (diff) | |
download | dconf-214f6587aa8f454a44cf3bac5c8ae7ef9161326b.tar.gz |
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.
Diffstat (limited to 'service')
-rw-r--r-- | 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); |