From fc10201ce26e310f90fc55e39c33eae4a5b9779c Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Wed, 10 Apr 2024 09:34:54 -0600 Subject: [PATCH] Remove occasionally incorrect expectation (#10358) This panic has occured a handful of times, I think it must be the case that: 1. Item is dropped outside of an update loop 2. The next update is this one In that case no flush effects will have called the release observers yet, but we cannot upgrade the WeakModel because the ref count is 0 Release Notes: - Fixed a (rare) panic while collaborating --- crates/workspace/src/item.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/crates/workspace/src/item.rs b/crates/workspace/src/item.rs index 9da551c4b6..26b46ea3d3 100644 --- a/crates/workspace/src/item.rs +++ b/crates/workspace/src/item.rs @@ -453,9 +453,7 @@ impl ItemHandle for View { } workspace.update(&mut cx, |workspace, cx| { - let item = item.upgrade().expect( - "item to be alive, otherwise task would have been dropped", - ); + let Some(item) = item.upgrade() else { return }; workspace.update_followers( is_project_item, proto::update_followers::Variant::UpdateView(