From 400eacbe0b61b460a2c0eca767d7bc0c8f2a0602 Mon Sep 17 00:00:00 2001 From: Joseph Perez Date: Tue, 11 Jun 2024 10:43:21 +0200 Subject: [PATCH] fix: make publisher lock safer --- zenoh/src/api/publisher.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zenoh/src/api/publisher.rs b/zenoh/src/api/publisher.rs index 2a0a47047b..ec8a8aff35 100644 --- a/zenoh/src/api/publisher.rs +++ b/zenoh/src/api/publisher.rs @@ -360,7 +360,8 @@ impl<'a> Publisher<'a> { } fn undeclare_matching_listeners(&self) -> ZResult<()> { - for id in zlock!(self.matching_listeners).drain() { + let ids: Vec = zlock!(self.matching_listeners).drain().collect(); + for id in ids { self.session.undeclare_matches_listener_inner(id)? } Ok(())