iced-rs / iced

A cross-platform GUI library for Rust, inspired by Elm
https://iced.rs
MIT License
24.93k stars 1.18k forks source link

Example "clock" crashes on macOS 11.1 #727

Closed yikerman closed 3 years ago

yikerman commented 3 years ago

Example "clock" crashes on macOS 11.1 with [1] 6987 segmentation fault cargo run --package clock. Backtrace generated using rust-lldb target/debug/clock. Seems like a problem with Metal.

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  * frame #0: 0x00007fff6ea9759b AMDMTLBronzeDriver`amdMtlBronzeResourceMgrValidateConstantState(BronzeCmdBufInfoRec*, BronzeRsrcMgrRec*, BronzeRsrcMgrConstStateRec const*) + 26
    frame #1: 0x00007fff6eaab2d7 AMDMTLBronzeDriver`amdMtlBronze_VI_DrawIndexPrims(BronzeRenderCmdEncoderMembersRec*, unsigned int, unsigned int, unsigned int, unsigned int, int, unsigned int) + 110
    frame #2: 0x00007fff6eaa358a AMDMTLBronzeDriver`-[BronzeMtlRenderCmdEncoder drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferOffset:] + 864
    frame #3: 0x00000001009c9fce clock`_$LT$$LP$A$C$B$C$C$C$D$C$E$RP$$u20$as$u20$objc..message..MessageArguments$GT$::invoke::hc34a3113f555ef1b(imp=(libobjc.A.dylib`objc_msgSend), obj=0x000000010808ce00, sel=Sel @ 0x00007ffeefbea238, (null)=<unavailable>) at mod.rs:128:17
    frame #4: 0x00000001009c957a clock`objc::message::platform::send_unverified::hffbc37341ccdddd5(obj=0x000000010808ce00, sel=Sel @ 0x00007ffeefbea2f0, args=(metal::encoder::MTLPrimitiveType, u64, metal::encoder::MTLIndexType, &metal::buffer::BufferRef, u64) @ 0x00007ffeefbea540) at mod.rs:27:9
    frame #5: 0x00000001009cfa16 clock`metal::encoder::RenderCommandEncoderRef::draw_indexed_primitives::h88a89f0aa3f92d84 [inlined] objc::message::send_message::hf18a9f7aa5c967d8(obj=0x000000010808ce00, sel=Sel @ 0x00007ffeefbea528, args=(metal::encoder::MTLPrimitiveType, u64, metal::encoder::MTLIndexType, &metal::buffer::BufferRef, u64) @ 0x00007ffeefbea3f8) at mod.rs:178:5
    frame #6: 0x00000001009cf9cb clock`metal::encoder::RenderCommandEncoderRef::draw_indexed_primitives::h88a89f0aa3f92d84(self=0x000000010808ce00, primitive_type=Triangle, index_count=741, index_type=UInt32, index_buffer=0x0000000102b0b260, index_buffer_offset=0) at encoder.rs:591
    frame #7: 0x00000001006074fb clock`gfx_backend_metal::command::exec_render::hb1789cb9da29cf55(encoder=0x000000010808ce00, command=<unavailable>, resources=0x0000000100d6f090) at command.rs:1719:17
    frame #8: 0x0000000100602a1b clock`gfx_backend_metal::command::PreRender::issue::h1e10c0636dfc3eb6(self=0x00007ffeefbeadc8, command=RenderCommand<&gfx_backend_metal::soft::Ref> @ 0x00007ffeefbeadf0) at command.rs:980:46
    frame #9: 0x000000010060eac2 clock`_$LT$gfx_backend_metal..command..CommandBuffer$u20$as$u20$gfx_hal..command..CommandBuffer$LT$gfx_backend_metal..Backend$GT$$GT$::draw_indexed::hb35fe4967a0bf72b(self=0x00007ffeefbec1b0, indices=Range<u32> @ 0x00007ffeefbeae28, base_vertex=0, instances=Range<u32> @ 0x00007ffeefbeae38) at command.rs:4296:9
    frame #10: 0x0000000100272aef clock`wgpu_core::command::render::_$LT$impl$u20$wgpu_core..hub..Global$LT$G$GT$$GT$::command_encoder_run_render_pass_impl::h27eebc04ec81e1c7(self=0x000000010300b410, encoder_id=Id<wgpu_core::command::CommandBuffer<gfx_backend_empty::Backend>> @ 0x00007ffeefbebec0, base=BasePassRef<wgpu_core::command::draw::RenderCommand> @ 0x00007ffeefbf2278, color_attachments=size=1, depth_stencil_attachment=Option<&wgpu_core::command::render::DepthStencilAttachmentDescriptor> @ 0x00007ffeefbf2230) at render.rs:1333:25
    frame #11: 0x000000010026b3a7 clock`wgpu_core::command::render::_$LT$impl$u20$wgpu_core..hub..Global$LT$G$GT$$GT$::command_encoder_run_render_pass::hc3185c5c188345ee(self=0x000000010300b410, encoder_id=Id<wgpu_core::command::CommandBuffer<gfx_backend_empty::Backend>> @ 0x00007ffeefbf22c0, pass=0x00007ffeefbf2c98) at render.rs:401:9
    frame #12: 0x000000010042fa88 clock`_$LT$wgpu..backend..direct..Context$u20$as$u20$wgpu..Context$GT$::command_encoder_end_render_pass::h65b886b5fef648cc(self=0x000000010300b410, encoder=0x00007ffeefbf3e90, pass=0x00007ffeefbf2c98) at direct.rs:1253:9
    frame #13: 0x000000010043345b clock`_$LT$wgpu..RenderPass$u20$as$u20$core..ops..drop..Drop$GT$::drop::hb5bf3f385c134ca0(self=0x00007ffeefbf2c98) at lib.rs:2280:13
    frame #14: 0x000000010014c875 clock`core::ptr::drop_in_place::h94a378eabba59639((null)=0x00007ffeefbf2c98) at mod.rs:175:1
    frame #15: 0x00000001000e39af clock`iced_wgpu::triangle::Pipeline::draw::hf05038631062fd74(self=0x0000000108827ec8, device=0x0000000108827768, staging_belt=0x0000000108827788, encoder=0x00007ffeefbf3e88, target=0x00007ffeefbf3e30, target_width=2048, target_height=1536, transformation=Transformation @ 0x00007ffeefbf3540, scale_factor=2, meshes=size=1) at triangle.rs:404:9
    frame #16: 0x00000001000a358f clock`iced_wgpu::backend::Backend::flush::h7201d6c1576a3af0(self=0x0000000108827818, device=0x0000000108827768, scale_factor=2, transformation=Transformation @ 0x00007ffeefbf3c40, layer=0x00007ffeefbf3bd0, staging_belt=0x0000000108827788, encoder=0x00007ffeefbf3e88, target=0x00007ffeefbf3e30, target_width=2048, target_height=1536) at backend.rs:132:13
    frame #17: 0x0000000100026833 clock`iced_wgpu::backend::Backend::draw::h2eeb05e24dcb73a1(self=0x0000000108827818, device=0x0000000108827768, staging_belt=0x0000000108827788, encoder=0x00007ffeefbf3e88, frame=0x00007ffeefbf3e30, viewport=0x0000000108826a00, (null)=0x0000000108828428, overlay_text=size=0) at backend.rs:82:13
    frame #18: 0x0000000100060ea1 clock`_$LT$iced_wgpu..window..compositor..Compositor$u20$as$u20$iced_graphics..window..compositor..Compositor$GT$::draw::h428452ed79180bda(self=0x0000000108827740, renderer=0x0000000108827818, swap_chain=0x00000001088283a0, viewport=0x0000000108826a00, background_color=Color @ 0x00007ffeefbf5028, output=0x0000000108828428, overlay=size=0) at compositor.rs:153:33
    frame #19: 0x0000000100046d09 clock`iced_winit::application::run_instance::_$u7b$$u7b$closure$u7d$$u7d$::h73adc8522454786b((null)=ResumeTy @ 0x00007ffeefbf5220) at application.rs:314:45
    frame #20: 0x0000000100074480 clock`_$LT$core..future..from_generator..GenFuture$LT$T$GT$$u20$as$u20$core..future..future..Future$GT$::poll::ha3ed67e94541480c(self=Pin<&mut core::future::from_generator::GenFuture<generator-0>> @ 0x00007ffeefbf5450, cx=0x0000000102d08700) at mod.rs:80:19
    frame #21: 0x0000000100048f9c clock`iced_winit::application::run::_$u7b$$u7b$closure$u7d$$u7d$::h24524b140d296822(event=Event<clock::Message> @ 0x00007ffeefbf5788, (null)=0x000000010e2084f0, control_flow=0x0000000100d974e8) at application.rs:170:24
    frame #22: 0x000000010006bdc7 clock`_$LT$alloc..boxed..Box$LT$F$C$A$GT$$u20$as$u20$core..ops..function..FnMut$LT$Args$GT$$GT$::call_mut::hc5919e8524696a75(self=0x0000000102d0cf60, args=(winit::event::Event<clock::Message>, &winit::event_loop::EventLoopWindowTarget<clock::Message>, &mut winit::event_loop::ControlFlow) @ 0x00007ffeefbf5718) at boxed.rs:1314:9
    frame #23: 0x0000000100001116 clock`_$LT$winit..platform_impl..platform..app_state..EventLoopHandler$LT$T$GT$$u20$as$u20$winit..platform_impl..platform..app_state..EventHandler$GT$::handle_nonuser_event::h53993247772ff5f2(self=0x0000000102d0cf60, event=<unavailable>, control_flow=0x0000000100d974e8) at app_state.rs:71:9
    frame #24: 0x0000000100ae99ce clock`winit::platform_impl::platform::app_state::Handler::handle_nonuser_event::hcc859cdfdacf640c(self=0x0000000100d974d8, wrapper=EventWrapper @ 0x00007ffeefbf6330) at app_state.rs:173:21
    frame #25: 0x0000000100aeb7f7 clock`winit::platform_impl::platform::app_state::AppState::cleared::h72da426ca5cd43f8 at app_state.rs:333:17
    frame #26: 0x0000000100ae694e clock`winit::platform_impl::platform::observer::control_flow_end_handler::h20276723ff58be49((null)=0x000000010e209d10, activity=32, (null)=0x0000000000000000) at observer.rs:135:13
    frame #27: 0x00007fff20448dad CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
    frame #28: 0x00007fff20448c3d CoreFoundation`__CFRunLoopDoObservers + 549
    frame #29: 0x00007fff20448221 CoreFoundation`__CFRunLoopRun + 1146
    frame #30: 0x00007fff204476ce CoreFoundation`CFRunLoopRunSpecific + 563
    frame #31: 0x00007fff286cc6d0 HIToolbox`RunCurrentEventLoopInMode + 292
    frame #32: 0x00007fff286cc4cc HIToolbox`ReceiveNextEventCommon + 709
    frame #33: 0x00007fff286cc1ef HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 64
    frame #34: 0x00007fff22c64de9 AppKit`_DPSNextEvent + 883
    frame #35: 0x00007fff22c635af AppKit`-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1366
    frame #36: 0x00007fff22c55b0a AppKit`-[NSApplication run] + 586
    frame #37: 0x0000000100b22466 clock`_$LT$$LP$$RP$$u20$as$u20$objc..message..MessageArguments$GT$::invoke::hf687aa1bdd41a374(imp=(libobjc.A.dylib`objc_msgSend), obj=0x0000000102b0f1c0, sel=Sel @ 0x00007ffeefbf8990, (null)=<unavailable>) at mod.rs:128:17
    frame #38: 0x0000000100b25002 clock`objc::message::platform::send_unverified::h7a61bbea34a82c9d(obj=0x0000000102b0f1c0, sel=Sel @ 0x00007ffeefbf8a00, args=<unavailable>) at mod.rs:27:9
    frame #39: 0x000000010003df80 clock`winit::platform_impl::platform::event_loop::EventLoop$LT$T$GT$::run_return::h54f4f7a92fcb7f40 [inlined] objc::message::send_message::he459d6c814ed2e38(obj=0x0000000102b0f1c0, sel=Sel @ 0x00007ffeefbf8d10) at mod.rs:178:5
    frame #40: 0x000000010003df65 clock`winit::platform_impl::platform::event_loop::EventLoop$LT$T$GT$::run_return::h54f4f7a92fcb7f40(self=0x00007ffeefbf8d48, callback=closure-1 @ 0x00007ffeefbf8d58) at event_loop.rs:106
    frame #41: 0x000000010003f1a4 clock`winit::platform_impl::platform::event_loop::EventLoop$LT$T$GT$::run::hc69f45e4cd9a77bf(self=EventLoop<clock::Message> @ 0x00007ffeefbf8d48, callback=<unavailable>) at event_loop.rs:93:9
    frame #42: 0x000000010002d890 clock`winit::event_loop::EventLoop$LT$T$GT$::run::h1ca4d6c5c481594d(self=EventLoop<clock::Message> @ 0x00007ffeefbf8db0, event_handler=<unavailable>) at event_loop.rs:154:9
    frame #43: 0x0000000100048ae3 clock`iced_winit::application::run::h67dbdbba27c7a2ce(settings=Settings<()> @ 0x00007ffeefbff480, compositor_settings=Settings @ 0x00007ffeefbff4e8) at application.rs:160:5
    frame #44: 0x000000010003769d clock`iced::application::Application::run::hdf96bd190d0b4885(settings=Settings<()> @ 0x00007ffeefbff5e0) at application.rs:206:16
    frame #45: 0x000000010000f5e9 clock`clock::main::h85c05a1347b94f88 at main.rs:8:5
    frame #46: 0x0000000100004f35 clock`core::ops::function::FnOnce::call_once::h723728953a83609e((null)=(clock`clock::main::h85c05a1347b94f88 at main.rs:7), (null)=<unavailable>) at function.rs:227:5
    frame #47: 0x000000010009015c clock`std::sys_common::backtrace::__rust_begin_short_backtrace::hfec324a42de0e36f(f=(clock`clock::main::h85c05a1347b94f88 at main.rs:7)) at backtrace.rs:125:18
    frame #48: 0x0000000100031ec8 clock`std::rt::lang_start::_$u7b$$u7b$closure$u7d$$u7d$::h303510a5ab7960ce at rt.rs:66:18
    frame #49: 0x0000000100c31c34 clock`std::rt::lang_start_internal::h36ccce6e8a047133 [inlined] core::ops::function::impls::_$LT$impl$u20$core..ops..function..FnOnce$LT$A$GT$$u20$for$u20$$RF$F$GT$::call_once::h81f763a559f81b5c at function.rs:259:13 [opt]
    frame #50: 0x0000000100c31c2d clock`std::rt::lang_start_internal::h36ccce6e8a047133 [inlined] std::panicking::try::do_call::h8f7e7501b4b6c841 at panicking.rs:381 [opt]
    frame #51: 0x0000000100c31c2d clock`std::rt::lang_start_internal::h36ccce6e8a047133 [inlined] std::panicking::try::h5def58989e0f2c84 at panicking.rs:345 [opt]
    frame #52: 0x0000000100c31c2d clock`std::rt::lang_start_internal::h36ccce6e8a047133 [inlined] std::panic::catch_unwind::h8210e1d7d92e8f91 at panic.rs:396 [opt]
    frame #53: 0x0000000100c31c2d clock`std::rt::lang_start_internal::h36ccce6e8a047133 at rt.rs:51 [opt]
    frame #54: 0x0000000100031ea1 clock`std::rt::lang_start::h755e55d874d52e0f(main=(clock`clock::main::h85c05a1347b94f88 at main.rs:7), argc=1, argv=0x00007ffeefbff820) at rt.rs:65:5
    frame #55: 0x000000010000fbe2 clock`main + 34
    frame #56: 0x00007fff2036c621 libdyld.dylib`start + 1
edgsousa commented 3 years ago

A me too, on Catalina (10.15.7). If I change the setting 'antialiasing' to false, it doesn't throw the segmentation fault.

yikerman commented 3 years ago

Seems like it's fixed now.

hecrj commented 3 years ago

@xiaoyu2006 Thanks for the heads up. It was probably fixed by #725.