crash in tessellating.rs, attempt to subtract with overflow when modifying features
Closed this issue · 4 comments
When trying to change the color of a rendered feature (on hover) the program crashes with:
attempt to subtract with overflow
.
Within an event handler I use get_features_at_mut
to find features within mouse position and toggle their highlighted state.
A corresponding custom symbol (adapted from the many_points example) is used to render the points in different colors depending on their highlighted state. Am I using galileo wrong in this case? Is modifying features like this supported at all?
NOTE: this also crashes if I just modify the features, but let the symbol change color depending on the value of feature.highlighted
.
I created a (failing) example for demonstration
Below is the stacktrace:
thread 'main' panicked at galileo/src/render/render_bundle/tessellating.rs:356:9:
attempt to subtract with overflow
stack backtrace:
0: rust_begin_unwind
at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library/std/src/panicking.rs:647:5
1: core::panicking::panic_fmt
at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library/core/src/panicking.rs:72:14
2: core::panicking::panic
at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library/core/src/panicking.rs:144:5
3: galileo::render::render_bundle::tessellating::TessellatingRenderBundle::remove_screen_ref
at ./galileo/src/render/render_bundle/tessellating.rs:356:9
4: galileo::render::render_bundle::tessellating::TessellatingRenderBundle::remove
at ./galileo/src/render/render_bundle/tessellating.rs:298:58
5: galileo::render::render_bundle::RenderBundle::remove
at ./galileo/src/render/render_bundle/mod.rs:81:54
6: galileo::layer::feature_layer::feature_render_store::FeatureRenderStore::remove_render
at ./galileo/src/layer/feature_layer/feature_render_store.rs:69:35
7: galileo::layer::feature_layer::FeatureLayer<P,F,S,Space>::update_feature_renders
at ./galileo/src/layer/feature_layer/mod.rs:328:29
8: galileo::layer::feature_layer::FeatureLayer<P,F,S,Space>::render_with_projection
at ./galileo/src/layer/feature_layer/mod.rs:276:13
9: <galileo::layer::feature_layer::FeatureLayer<P,F,S,galileo_types::geometry_type::CartesianSpace2d> as galileo::layer::Layer>::render
at ./galileo/src/layer/feature_layer/mod.rs:480:9
10: <alloc::sync::Arc<std::sync::rwlock::RwLock<T>> as galileo::layer::Layer>::render
at ./galileo/src/layer/mod.rs:43:9
11: galileo::render::wgpu::WgpuRenderer::render_layer
at ./galileo/src/render/wgpu/mod.rs:639:9
12: galileo::render::wgpu::WgpuRenderer::render_map
at ./galileo/src/render/wgpu/mod.rs:626:13
13: galileo::render::wgpu::WgpuRenderer::render_to_texture_view
at ./galileo/src/render/wgpu/mod.rs:604:9
14: galileo::render::wgpu::WgpuRenderer::render
at ./galileo/src/render/wgpu/mod.rs:616:9
15: galileo::galileo_map::GalileoMap::run::{{closure}}
at ./galileo/src/galileo_map.rs:107:55
16: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library/core/src/ops/function.rs:294:13
17: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library/core/src/ops/function.rs:294:13
18: winit::platform_impl::platform::x11::EventLoop<T>::single_iteration
at /home/l/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/x11/mod.rs:602:17
19: winit::platform_impl::platform::x11::EventLoop<T>::poll_events_with_timeout
at /home/l/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/x11/mod.rs:541:9
20: winit::platform_impl::platform::x11::EventLoop<T>::pump_events
at /home/l/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/x11/mod.rs:447:13
21: winit::platform_impl::platform::x11::EventLoop<T>::run_on_demand
at /home/l/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/x11/mod.rs:408:19
22: winit::platform_impl::platform::EventLoop<T>::run_on_demand
at /home/l/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/mod.rs:829:56
23: winit::platform_impl::platform::EventLoop<T>::run
at /home/l/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/mod.rs:822:9
24: winit::event_loop::EventLoop<T>::run
at /home/l/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/event_loop.rs:249:9
25: galileo::galileo_map::GalileoMap::run
at ./galileo/src/galileo_map.rs:50:9
26: highlight_features::run::{{closure}}
at ./galileo/examples/highlight_features.rs:125:5
27: highlight_features::main::{{closure}}
at ./galileo/examples/highlight_features.rs:20:28
28: tokio::runtime::park::CachedParkThread::block_on::{{closure}}
at /home/l/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.36.0/src/runtime/park.rs:281:63
29: tokio::runtime::coop::with_budget
at /home/l/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.36.0/src/runtime/coop.rs:107:5
30: tokio::runtime::coop::budget
at /home/l/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.36.0/src/runtime/coop.rs:73:5
31: tokio::runtime::park::CachedParkThread::block_on
at /home/l/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.36.0/src/runtime/park.rs:281:31
32: tokio::runtime::context::blocking::BlockingRegionGuard::block_on
at /home/l/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.36.0/src/runtime/context/blocking.rs:66:9
33: tokio::runtime::scheduler::multi_thread::MultiThread::block_on::{{closure}}
at /home/l/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.36.0/src/runtime/scheduler/multi_thread/mod.rs:87:13
34: tokio::runtime::context::runtime::enter_runtime
at /home/l/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.36.0/src/runtime/context/runtime.rs:65:16
35: tokio::runtime::scheduler::multi_thread::MultiThread::block_on
at /home/l/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.36.0/src/runtime/scheduler/multi_thread/mod.rs:86:9
36: tokio::runtime::runtime::Runtime::block_on
at /home/l/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.36.0/src/runtime/runtime.rs:350:45
37: highlight_features::main
at ./galileo/examples/highlight_features.rs:20:5
38: core::ops::function::FnOnce::call_once
at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Hi, @lennart . Thanks for the report. I am currently don't have much time to work on Galileo, but am planning to return to it somewhere at the end of summer. I will definitely look into this issue then (unless someone else fixes it earlier).
@Maximkaaa thanks for the reply, I found the bug (as far as I understood), see pr #69
We can mark this issue as resolved now!