Commit e9e7cda6 authored by Carlos Garnacho's avatar Carlos Garnacho

tracker-extract: Cache TrackerConfig::max-bytes

This is the only setting read from extractor modules. It turns out
that under the right circumstances a g_settings_get_value() call
can trigger open() calls with readwrite permissions from the caller
thread. This is forbidden in extractor threads and triggers warnings
like:

dconf-CRITICAL **: unable to create file '/run/user/1000/dconf/user':
Permission denied.  dconf will not work properly.

Also, since this setting is meaningless to update during tracker-extract
lifetime, just drop the g_settings_bind() call, this means the setting
is only read once on startup.

https://bugzilla.gnome.org/show_bug.cgi?id=779342
parent 53007652
......@@ -226,9 +226,14 @@ config_constructed (GObject *object)
*/
g_settings_bind (settings, "verbosity", object, "verbosity", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_GET_NO_CHANGES);
g_settings_bind (settings, "sched-idle", object, "sched-idle", G_SETTINGS_BIND_GET);
g_settings_bind (settings, "max-bytes", object, "max-bytes", G_SETTINGS_BIND_GET);
g_settings_bind (settings, "max-media-art-width", object, "max-media-art-width", G_SETTINGS_BIND_GET);
g_settings_bind (settings, "wait-for-miner-fs", object, "wait-for-miner-fs", G_SETTINGS_BIND_GET);
/* Cache settings accessed from extractor modules, we don't want
* the GSettings object accessed within these as it may trigger
* unintended open() calls.
*/
TRACKER_CONFIG (settings)->max_bytes = g_settings_get_int (settings, "max-bytes");
}
TrackerConfig *
......@@ -303,7 +308,7 @@ tracker_config_get_max_bytes (TrackerConfig *config)
{
g_return_val_if_fail (TRACKER_IS_CONFIG (config), 0);
return g_settings_get_int (G_SETTINGS (config), "max-bytes");
return config->max_bytes;
}
gint
......
......@@ -36,7 +36,7 @@ typedef struct TrackerConfigClass TrackerConfigClass;
struct TrackerConfig {
GSettings parent;
gpointer priv;
gint max_bytes;
};
struct TrackerConfigClass {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment