[rygel] tracker3: Don't create connection in static constructor
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] tracker3: Don't create connection in static constructor
- Date: Fri, 15 Oct 2021 07:08:01 +0000 (UTC)
commit 0b8d456d6cb42768eef9938b314dd3f5dcd8665b
Author: Jan Alexander Steffens (heftig) <jan steffens gmail com>
Date: Wed Oct 13 17:33:05 2021 +0000
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.
src/plugins/tracker3/rygel-tracker-root-container.vala | 14 +++++++-------
1 file 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 c5d3b25a5..c7f722a81 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")) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]