Fixing a crate. Getting an unwrap panic. Takes about half an hour of running a GUI program to get this intermittent error, so it has to be run in release mode. Thus some inlines don't appear in the backtrace.
Backtrace says it's here at
let mesh = &mesh_manager_guard[**mesh];
There's no explicit unwrap call inside the function ObjectManager::add
which contains that line. The backtrace shows control in that function, so this is the right place to look.
So, what implicit operation could be failing? **mesh
means deferencing the contents of an ObjectMeshKind::Static
, which is a MeshHandle
, which is a ResourceHandle<Mesh>.
ResourceHandle has an implementation of Deref, so there's an implicit function call.
But the Deref called is here, and it has no .unwrap() call. So the first Deref should not cause that error.
The result of the first Deref
is a RawResourceHandle
. That doesn't have a Deref
function defined.
So I haven't been able to find which unwrap
call is causing the problem. What else might be called implicitly? Advice?
Actual backtrace below:
Panic called `Option::unwrap()` on a `None` value at file /home/john/.cargo/git/checkouts/rend3-hp-02d0af34d7a82ce7/fd670d4/rend3/src/managers/object.rs, line 136 in thread main.
Backtrace:
libcommon::common::commonutils::catch_panic::{{closure}}
at /home/john/projects/sl/SL-test-viewer/libcommon/src/common/commonutils.rs:389:25
rend3::managers::object::ObjectManager::add
rend3::renderer::eval::evaluate_instructions
at /home/john/.cargo/git/checkouts/rend3-hp-02d0af34d7a82ce7/fd670d4/rend3/src/renderer/eval.rs:72:21
rend3::renderer::Renderer::evaluate_instructions
at /home/john/.cargo/git/checkouts/rend3-hp-02d0af34d7a82ce7/fd670d4/rend3/src/renderer/mod.rs:422:9
<sharpview::AppUi as rend3_framework::App>::handle_redraw
at /home/john/projects/sl/SL-test-viewer/sharpview/src/main.rs:723:31
rend3_framework::async_start::{{closure}}::{{closure}}
at /home/john/.cargo/git/checkouts/rend3-hp-02d0af34d7a82ce7/fd670d4/rend3-framework/src/lib.rs:345:17
winit::platform_impl::linux::x11::EventLoop::single_iteration
at /home/john/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.30.7/src/platform_impl/linux/x11/mod.rs:563:17
winit::platform_impl::linux::x11::EventLoop::poll_events_with_timeout
at /home/john/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.30.7/src/platform_impl/linux/x11/mod.rs:504:9
winit::platform_impl::linux::x11::EventLoop::pump_events
at /home/john/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.30.7/src/platform_impl/linux/x11/mod.rs:424:13
winit::platform_impl::linux::x11::EventLoop::run_on_demand
at /home/john/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.30.7/src/platform_impl/linux/x11/mod.rs:385:19