From d619bd13cdd45ff9bdf38b5c8c4255b7c0b4cd62 Mon Sep 17 00:00:00 2001 From: PapyElGringo Date: Fri, 30 Aug 2024 06:23:47 +0200 Subject: [PATCH] Work around a dbus-broker bug with path_namespace='/' match rules (#381) --- lib/src/dbus_remote_object_manager.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/src/dbus_remote_object_manager.dart b/lib/src/dbus_remote_object_manager.dart index fb3d658..fe52ca4 100644 --- a/lib/src/dbus_remote_object_manager.dart +++ b/lib/src/dbus_remote_object_manager.dart @@ -52,8 +52,13 @@ class DBusRemoteObjectManager extends DBusRemoteObject { DBusRemoteObjectManager(DBusClient client, {required String name, required DBusObjectPath path}) : super(client, name: name, path: path) { + // Only add path_namespace if it's non-'/'. This removes a no-op key from + // the match rule, and also works around a D-Bus bug where + // path_namespace='/' matches nothing. + // https://github.com/bus1/dbus-broker/issues/309 + var pathNamespace = path.value != '/' ? path : null; var rawSignals = - DBusSignalStream(client, sender: name, pathNamespace: path); + DBusSignalStream(client, sender: name, pathNamespace: pathNamespace); signals = rawSignals.map((signal) { if (signal.interface == 'org.freedesktop.DBus.ObjectManager' && signal.name == 'InterfacesAdded' &&