[tracker] libtracker-sparql: Make sure we check the env before choosing the bus type
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] libtracker-sparql: Make sure we check the env before choosing the bus type
- Date: Mon, 24 Mar 2014 16:13:14 +0000 (UTC)
commit 4bd4b1e236b783e279f0ad5cacc3e581f7ad4cd5
Author: Haithem Ben Ghorbal <haithem benghorbal_ext softathome com>
Date: Mon Mar 24 15:33:27 2014 +0000
libtracker-sparql: Make sure we check the env before choosing the bus type
Previously we would check the env for the plugins (backends), but not for
checking if the store was available or not, which is quite important because
it can cause the store to be instantiated!
src/libtracker-sparql-backend/tracker-backend.vala | 33 +++++++++++--------
1 files changed, 19 insertions(+), 14 deletions(-)
---
diff --git a/src/libtracker-sparql-backend/tracker-backend.vala
b/src/libtracker-sparql-backend/tracker-backend.vala
index e4e5488..13b1f07 100644
--- a/src/libtracker-sparql-backend/tracker-backend.vala
+++ b/src/libtracker-sparql-backend/tracker-backend.vala
@@ -30,6 +30,9 @@ class Tracker.Sparql.Backend : Connection {
public Backend () throws Sparql.Error, IOError, DBusError, SpawnError {
try {
+ // Important to make sure we check the right bus for the store
+ load_env ();
+
// Makes sure the sevice is available
debug ("Waiting for service to become available...");
@@ -51,6 +54,22 @@ class Tracker.Sparql.Backend : Connection {
initialized = true;
}
+ private void load_env () {
+ string env_bus_type = Environment.get_variable ("TRACKER_BUS_TYPE");
+
+ if (env_bus_type != null) {
+ if (env_bus_type.ascii_casecmp ("system") == 0) {
+ bus_type = BusType.SYSTEM;
+ debug ("Using bus = 'SYSTEM'");
+ } else if (env_bus_type.ascii_casecmp ("session") == 0) {
+ bus_type = BusType.SESSION;
+ debug ("Using bus = 'SESSION'");
+ } else {
+ warning ("Environment variable TRACKER_BUS_TYPE set to unknown value '%s'",
env_bus_type);
+ }
+ }
+ }
+
public override void dispose () {
// trying to lock on partially initialized instances will deadlock
if (initialized) {
@@ -165,20 +184,6 @@ class Tracker.Sparql.Backend : Connection {
// Plugin loading functions
private void load_plugins () throws GLib.Error {
- string env_bus_type = Environment.get_variable ("TRACKER_BUS_TYPE");
-
- if (env_bus_type != null) {
- if (env_bus_type.ascii_casecmp ("system") == 0) {
- bus_type = BusType.SYSTEM;
- debug ("Using bus = 'SYSTEM'");
- } else if (env_bus_type.ascii_casecmp ("session") == 0) {
- bus_type = BusType.SESSION;
- debug ("Using bus = 'SESSION'");
- } else {
- warning ("Environment variable TRACKER_BUS_TYPE set to unknown value '%s'",
env_bus_type);
- }
- }
-
string env_backend = Environment.get_variable ("TRACKER_SPARQL_BACKEND");
Backend backend = Backend.AUTO;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]