From 75eec8bd4f0cf0277d8934ffe7c69cfd8dec0396 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Thu, 21 Jun 2018 11:23:13 +0600 Subject: [PATCH] fix condition --- src/with.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/with.rs b/src/with.rs index 423e558a2..4f53a316d 100644 --- a/src/with.rs +++ b/src/with.rs @@ -224,7 +224,7 @@ where let h = self.hnd.as_ref().hnd.clone(); // Enforce invariants before entering unsafe code. // Only two references could exists With struct owns one, and line above - if Rc::weak_count(&h) != 0 && Rc::strong_count(&h) != 2 { + if Rc::weak_count(&h) != 0 || Rc::strong_count(&h) != 2 { panic!("Multiple copies of handler are in use") } let hnd: &mut F = unsafe { &mut *h.as_ref().get() }; @@ -384,7 +384,7 @@ where let h = self.hnd.as_ref().hnd.clone(); // Enforce invariants before entering unsafe code. // Only two references could exists With struct owns one, and line above - if Rc::weak_count(&h) != 0 && Rc::strong_count(&h) != 2 { + if Rc::weak_count(&h) != 0 || Rc::strong_count(&h) != 2 { panic!("Multiple copies of handler are in use") } let hnd: &mut F = unsafe { &mut *h.as_ref().get() };