diff options
author | Ryan Lortie <desrt@desrt.ca> | 2012-07-12 22:57:04 -0400 |
---|---|---|
committer | Ryan Lortie <desrt@desrt.ca> | 2012-07-12 22:57:04 -0400 |
commit | 8b08defe6463ad1f2e74d3e8708dd2af7d597d04 (patch) | |
tree | ebe099a49c41a5f89923968d0b90bf8e92f7cc37 /engine | |
parent | 207918c6281deb82e65243fb33eb6ef7d4f2a59c (diff) | |
download | dconf-8b08defe6463ad1f2e74d3e8708dd2af7d597d04.tar.gz |
DConfEngineSource: return FALSE from NULL refresh
In the case that we call dconf_engine_source_refresh() on a source that
had a NULL database and the result is that we still have a NULL
database, return FALSE.
This will prevent the unnecessary bumping of the state counter when
there was really no change. This happens in the case of a missing
system database file.
Diffstat (limited to 'engine')
-rw-r--r-- | engine/dconf-engine-source.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/engine/dconf-engine-source.c b/engine/dconf-engine-source.c index 3c1f330..834644c 100644 --- a/engine/dconf-engine-source.c +++ b/engine/dconf-engine-source.c @@ -45,6 +45,12 @@ dconf_engine_source_refresh (DConfEngineSource *source) { if (source->vtable->needs_reopen (source)) { + gboolean was_open; + gboolean is_open; + + /* Record if we had a gvdb before or not. */ + was_open = source->values != NULL; + g_clear_pointer (&source->values, gvdb_table_unref); g_clear_pointer (&source->locks, gvdb_table_unref); @@ -52,7 +58,14 @@ dconf_engine_source_refresh (DConfEngineSource *source) if (source->values) source->locks = gvdb_table_get_table (source->values, ".locks"); - return TRUE; + /* Check if we ended up with a gvdb. */ + is_open = source->values != NULL; + + /* Only return TRUE in the case that we either had a database + * before or ended up with one after. In the case that we just go + * from NULL to NULL, return FALSE. + */ + return was_open || is_open; } return FALSE; |