diff options
author | Jan Alexander Steffens (heftig) <jan.steffens@gmail.com> | 2021-10-13 17:33:05 +0000 |
---|---|---|
committer | Jan Alexander Steffens (heftig) <jan.steffens@gmail.com> | 2021-10-13 17:38:48 +0000 |
commit | 0b8d456d6cb42768eef9938b314dd3f5dcd8665b (patch) | |
tree | 6bae54b32ff02e9f4df950176b9636f61f6f0d79 /src | |
parent | 0a62114023d06991e6aa4c340a1199d5aa3ed3a4 (diff) | |
download | rygel-0b8d456d6cb42768eef9938b314dd3f5dcd8665b.tar.gz |
tracker3: Don't create connection in static constructor
bus_new will wait for work in the GDBus thread to be completed. However,
further type initialization in the GDBus thread will block on the GType
class_init_rec_mutex we're already holding and we end up in a deadlock.
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/tracker3/rygel-tracker-root-container.vala | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/plugins/tracker3/rygel-tracker-root-container.vala b/src/plugins/tracker3/rygel-tracker-root-container.vala index c5d3b25a..c7f722a8 100644 --- a/src/plugins/tracker3/rygel-tracker-root-container.vala +++ b/src/plugins/tracker3/rygel-tracker-root-container.vala @@ -34,15 +34,15 @@ public class Rygel.Tracker.RootContainer : Rygel.SimpleContainer { public static Sparql.Connection connection; - static construct { - try { - RootContainer.connection = Sparql.Connection.bus_new (TRACKER_SERVICE, null); - } catch (Error err) { - error ("Failed to connect to tracker: %s", err.message); + public RootContainer (string title) { + if (RootContainer.connection == null) { + try { + RootContainer.connection = Sparql.Connection.bus_new (TRACKER_SERVICE, null); + } catch (Error err) { + error ("Failed to connect to tracker: %s", err.message); + } } - } - public RootContainer (string title) { base.root (title); if (this.get_bool_config_without_error ("share-music")) { |