changeset 27:385f1b74b9e5

Only panic on unreleased Hold when the thread is not already panicking
author Lewin Bormann <lewin@lewin-bormann.info>
date Thu, 06 Jun 2019 22:27:45 +0200
parents 6b717ea3438b
children f3b758646c58
files src/state.rs
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/state.rs	Wed Jun 05 22:33:27 2019 +0200
+++ b/src/state.rs	Thu Jun 06 22:27:45 2019 +0200
@@ -50,7 +50,9 @@
 
 impl Drop for Hold {
     fn drop(&mut self) {
-        assert!(self.released, "Dropped unreleased hold! This is a bug");
+        if !std::thread::panicking() {
+            assert!(self.released, "Dropped unreleased hold! This is a bug");
+        }
     }
 }