Commit 3dcb7437 authored by Juerg Billeter's avatar Juerg Billeter Committed by Jürg Billeter

libtracker-sparql-backend: Work around race condition in GDBus

GDBusProxy created from a thread without its own GMainContext may cause
memory corruption due to a race condition in handling the
NameOwnerChanged signal.

As we only call a single method on the Status object, drop use of
GDBusProxy in this case and directly use low level D-Bus support.

Fixes NB#254855.
parent 2433aa57
......@@ -17,11 +17,6 @@
* Boston, MA 02110-1301, USA.
[DBus (name = "org.freedesktop.Tracker1.Status")]
interface Tracker.Backend.Status : DBusProxy {
public abstract void wait () throws DBusError;
class Tracker.Sparql.Backend : Connection {
bool initialized;
Tracker.Sparql.Connection direct = null;
......@@ -33,18 +28,18 @@ class Tracker.Sparql.Backend : Connection {
public Backend () throws Sparql.Error, IOError, DBusError, SpawnError {
Tracker.Backend.Status status = GLib.Bus.get_proxy_sync (BusType.SESSION,
status.set_default_timeout (int.MAX);
try {
// Makes sure the sevice is available
debug ("Waiting for service to become available...");
// Makes sure the sevice is available
debug ("Waiting for service to become available...");
status.wait ();
debug ("Service is ready");
// do not use proxy to work around race condition in GDBus
// NB#259760
var bus = GLib.Bus.get_sync (BusType.SESSION);
bus.send_message_with_reply_sync (msg, 0, /* timeout */ int.MAX, null).to_gerror ();
debug ("Service is ready");
try {
debug ("Constructing connection, direct_only=%s", direct_only ? "true" : "false");
load_plugins (direct_only);
debug ("Backend is ready");
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