From f4c4af2bd485b88b7928d9a0ac35a06db2907e70 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Fri, 15 May 2020 12:12:37 +0200 Subject: [PATCH] Don't panic while already panicking in BoxSlot::drop --- components/layout_2020/dom_traversal.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/layout_2020/dom_traversal.rs b/components/layout_2020/dom_traversal.rs index a8f5a17fc1d..c043d3b75d3 100644 --- a/components/layout_2020/dom_traversal.rs +++ b/components/layout_2020/dom_traversal.rs @@ -346,8 +346,10 @@ impl BoxSlot<'_> { impl Drop for BoxSlot<'_> { fn drop(&mut self) { - if let Some(slot) = &mut self.slot { - assert!(slot.borrow().is_some(), "failed to set a layout box"); + if !std::thread::panicking() { + if let Some(slot) = &mut self.slot { + assert!(slot.borrow().is_some(), "failed to set a layout box"); + } } } }