From e5a17ee232956cac6a02389bc606899b3b5d4c1a Mon Sep 17 00:00:00 2001 From: Martin Dahl Date: Wed, 14 Oct 2020 23:50:41 +0200 Subject: [PATCH] Lock the context when dropping nodes --- src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index f586d67..4b7bad0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1209,6 +1209,9 @@ where impl Drop for Node { fn drop(&mut self) { + // fini functions are not thread safe so lock the context. + let _ctx_handle = self.context.context_handle.lock().unwrap(); + for s in &mut self.subs { s.destroy(&mut self.node_handle); }