diff options
author | Ryan Lortie <desrt@desrt.ca> | 2013-11-25 11:37:24 -0500 |
---|---|---|
committer | Ryan Lortie <desrt@desrt.ca> | 2013-11-25 12:23:16 -0500 |
commit | 048e2e5e9c89eb08ef954194f2a5505e3d4ace3a (patch) | |
tree | 4421b539bdefc57910fd54cca4d49dde1ab21063 /engine | |
parent | b7978d79b21340bb80725c6deb7e2aafba436175 (diff) | |
download | dconf-048e2e5e9c89eb08ef954194f2a5505e3d4ace3a.tar.gz |
engine: issue warnings once per source
On failure to open a gvdb file in /etc/dconf/db we would issue a warning
once per process -- even if multiple files were missing.
This was enforced using a static variable.
An unfortunate side effect of this global state is that the testcases
couldn't reliably know if to expect the error or not. This issue was
side-stepped by running any cases that may emit the warning under a
fork, but that made it difficult to debug some of the cases.
Rework the backends not to use global state for the flag and instead
store it per-source.
Remove a use of g_test_trap_fork().
Diffstat (limited to 'engine')
-rw-r--r-- | engine/dconf-engine-source-service.c | 5 | ||||
-rw-r--r-- | engine/dconf-engine-source-system.c | 5 | ||||
-rw-r--r-- | engine/dconf-engine-source.h | 1 |
3 files changed, 5 insertions, 6 deletions
diff --git a/engine/dconf-engine-source-service.c b/engine/dconf-engine-source-service.c index 0bd0c05..b4da653 100644 --- a/engine/dconf-engine-source-service.c +++ b/engine/dconf-engine-source-service.c @@ -48,7 +48,6 @@ dconf_engine_source_service_needs_reopen (DConfEngineSource *source) static GvdbTable * dconf_engine_source_service_reopen (DConfEngineSource *source) { - static gboolean did_warn; GError *error = NULL; GvdbTable *table; gchar *filename; @@ -68,10 +67,10 @@ dconf_engine_source_service_reopen (DConfEngineSource *source) if (table == NULL) { - if (!did_warn) + if (!source->did_warn) { g_warning ("unable to open file '%s': %s; expect degraded performance", filename, error->message); - did_warn = TRUE; + source->did_warn = TRUE; } g_error_free (error); diff --git a/engine/dconf-engine-source-system.c b/engine/dconf-engine-source-system.c index 5d48e7f..30e67eb 100644 --- a/engine/dconf-engine-source-system.c +++ b/engine/dconf-engine-source-system.c @@ -45,7 +45,6 @@ dconf_engine_source_system_needs_reopen (DConfEngineSource *source) static GvdbTable * dconf_engine_source_system_reopen (DConfEngineSource *source) { - static gboolean did_warn; GError *error = NULL; GvdbTable *table; gchar *filename; @@ -55,10 +54,10 @@ dconf_engine_source_system_reopen (DConfEngineSource *source) if (table == NULL) { - if (!did_warn) + if (!source->did_warn) { g_warning ("unable to open file '%s': %s; expect degraded performance", filename, error->message); - did_warn = TRUE; + source->did_warn = TRUE; } g_error_free (error); diff --git a/engine/dconf-engine-source.h b/engine/dconf-engine-source.h index 3828dba..8aefc41 100644 --- a/engine/dconf-engine-source.h +++ b/engine/dconf-engine-source.h @@ -47,6 +47,7 @@ struct _DConfEngineSource GvdbTable *locks; GBusType bus_type; gboolean writable; + gboolean did_warn; gchar *bus_name; gchar *object_path; gchar *name; |