diff options
author | Jan Alexander Steffens (heftig) <jan.steffens@gmail.com> | 2021-10-13 17:33:05 +0000 |
---|---|---|
committer | Jens Georg <mail@jensge.org> | 2021-10-15 07:14:41 +0000 |
commit | b745137743680a1d97909d3f32aa9450b3888c8c (patch) | |
tree | 4801049370f08851f9e2864525b3de8580d300b3 | |
parent | 4fcf3ae80a25fad8837573d5030d672ab2815ac5 (diff) | |
download | rygel-b745137743680a1d97909d3f32aa9450b3888c8c.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.
(cherry picked from commit 0b8d456d6cb42768eef9938b314dd3f5dcd8665b)
-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")) { |