From 4e327d694173322aaf07a5a2315e1e24939911b3 Mon Sep 17 00:00:00 2001 From: r0e Date: Thu, 21 May 2015 17:19:26 -0700 Subject: [PATCH] if thread panics then assertion for PendingLoadGuard destructor is not run --- components/net_traits/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/net_traits/lib.rs b/components/net_traits/lib.rs index d2ecae532be..afbb6d0b5c8 100644 --- a/components/net_traits/lib.rs +++ b/components/net_traits/lib.rs @@ -26,6 +26,7 @@ use msg::constellation_msg::{PipelineId}; use url::Url; use std::sync::mpsc::{channel, Receiver, Sender}; +use std::thread; pub mod image_cache_task; pub mod storage_task; @@ -147,7 +148,9 @@ impl PendingLoadGuard { impl Drop for PendingLoadGuard { fn drop(&mut self) { - assert!(self.loaded) + if !thread::panicking() { + assert!(self.loaded) + } } }