Closed zeenix closed 1 year ago
In GitLab by @MaxVerevkin on Nov 21, 2021, 08:58
Looks like this was introduced in 06d2d983
In GitLab by @MaxVerevkin on Nov 21, 2021, 10:50
m.event
should be recreated after https://gitlab.freedesktop.org/dbus/zbus/-/blob/main/zbus/src/proxy.rs#L244
The stream must either lock the mutex and get the event:
diff --git a/zbus/src/proxy.rs b/zbus/src/proxy.rs
index e8cd19b..e7a30bd 100644
--- a/zbus/src/proxy.rs
+++ b/zbus/src/proxy.rs
@@ -243,6 +243,15 @@ where
};
ready!(Pin::new(&mut m.event).poll(cx));
+ m.event = properties
+ .values
+ .lock()
+ .unwrap()
+ .get(m.name)
+ .unwrap()
+ .event
+ .listen();
+
let prop_changed = PropertyChanged {
name: m.name,
properties,
or hold Arc<Event>
. Which is better?
@MaxVerevkin thanks so much for reporting and even figuring out the solution. :thumbsup:
Which is better?
The former (locking) is good and sort of what we had before 06d2d983. Only now the lock will be only held for the cloning. Maybe it'd be good idea to switch to RwLock
here.
Since you've a test case for the code, if you decide to provide an MR for this, please do add the testcase (just modify the existing test for property stream) too so we don't break this in the future. :)
mentioned in commit f8b63eb35283ac0c0486f16a16fec5d8599a8a92
In GitLab by @MaxVerevkin on Nov 21, 2021, 06:14
Minimal example:
Produces this: