tauri-apps / muda

Menu Utilities for Desktop Applications in Rust.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

segfault on `set_menu`

grant0417 opened this issue · comments

I am running set_menu multiple times to change the content in the menu but I got a segfault after the second set_menu call. This happens with the tray_icon library, but the actual segfault is in the muda code.

My code looks something like:

let event_loop = /* make tao::event_loop::EventLoop */
let tray = /* make tray_icon::TrayIcon */

event_loop.run(move |event, window_target, control_flow| {
   if refresh_tray {
       tray.set_menu(Some(Box::new(/* build menu */));
   }

   /* handle events */
})

Here is the associated stack trace:

* thread #1, name = 'main', queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x7)
  * frame #0: 0x00000001a7d99c34 libobjc.A.dylib`objc_msgSend + 52
    frame #1: 0x00000001ab415f24 AppKit`recursivelyCollectMenuItemsNeedingKERegistration + 148
    frame #2: 0x00000001ab58eb54 AppKit`+[NSMenu(NSKeyEquivalents) _recursivelyUnregisterMenuForKeyEquivalentUniquing:] + 48
    frame #3: 0x00000001ab609508 AppKit`-[NSMenu removeAllItems] + 96
    frame #4: 0x0000000102184bfc app`<() as objc::message::MessageArguments>::invoke(imp=0x00000001a7d99c00, obj=0x0000000106f5a790, sel=objc::runtime::Sel @ 0x000000016fde42b8, (null)=()) at mod.rs:128:17
    frame #5: 0x0000000102183f28 app`objc::message::platform::send_unverified(obj=0x0000000106f5a790, sel=objc::runtime::Sel @ 0x000000016fde4320, args=()) at mod.rs:27:9
    frame #6: 0x0000000100b7e9b4 app`<muda::platform_impl::platform::NsMenuRef as core::ops::drop::Drop>::drop [inlined] objc::message::send_message(obj=0x0000000106f5a790, sel=objc::runtime::Sel @ 0x000000016fde4480, args=<unavailable>) at mod.rs:178:5
    frame #7: 0x0000000100b7e9a0 app`<muda::platform_impl::platform::NsMenuRef as core::ops::drop::Drop>::drop(self=0x0000000106f76fc8) at mod.rs:56:25
    frame #8: 0x0000000100b926a4 app`core::ptr::drop_in_place<muda::platform_impl::platform::NsMenuRef>((null)=0x0000000106f76fc8) at mod.rs:497:1
    frame #9: 0x0000000100b923b8 app`core::ptr::drop_in_place<muda::platform_impl::platform::Menu>((null)=0x0000000106f76f98) at mod.rs:497:1
    frame #10: 0x0000000100b932f8 app`core::ptr::drop_in_place<core::cell::UnsafeCell<muda::platform_impl::platform::Menu>>((null)=0x0000000106f76f98) at mod.rs:497:1
    frame #11: 0x0000000100b9301c app`core::ptr::drop_in_place<core::cell::RefCell<muda::platform_impl::platform::Menu>>((null)={...}) at mod.rs:497:1
    frame #12: 0x0000000100b974dc app`<alloc::rc::Rc<T> as core::ops::drop::Drop>::drop(self=(refs:0,weak:1) <disposed>) at rc.rs:1607:17
    frame #13: 0x0000000100b91074 app`core::ptr::drop_in_place<alloc::rc::Rc<core::cell::RefCell<muda::platform_impl::platform::Menu>>>((null)=(refs:0,weak:1) <disposed>) at mod.rs:497:1
    frame #14: 0x0000000100b91bec app`core::ptr::drop_in_place<muda::menu::Menu>((null)=0x0000000106a275c0) at mod.rs:497:1
    frame #15: 0x0000000100b7d0c0 app`core::ptr::drop_in_place<alloc::boxed::Box<dyn muda::ContextMenu>>((null)=0x0000000106daa8a8) at mod.rs:497:1
    frame #16: 0x0000000100b7d590 app`core::ptr::drop_in_place<core::option::Option<alloc::boxed::Box<dyn muda::ContextMenu>>>((null)=Global>>{...}) at mod.rs:497:1
    frame #17: 0x0000000100b75bc4 app`tray_icon::platform_impl::platform::TrayIcon::set_menu(self=0x0000000106daa868, menu=Some({...})) at mod.rs:138:9
    frame #18: 0x0000000100b740d0 app`tray_icon::TrayIcon::set_menu(self=0x0000000106de9aa0, menu=Some({...})) at lib.rs:339:9
    frame #19: 0x00000001005f33bc app`app::webview::WebviewManager::run::{{closure}}::{{closure}}(event=tao::event::Event<app::event::Event>::MainEventsCleared @ 0x000000016fdece40, window_target=0x0000000106d4b940, control_flow=0x00000001034c0728) at mod.rs:349:17
    frame #20: 0x00000001000d145c app`<tao::platform_impl::platform::app_state::EventLoopHandler<T> as tao::platform_impl::platform::app_state::EventHandler>::handle_nonuser_event::{{closure}}(this=0x0000000106de92e0, callback={...}) at app_state.rs:105:9
    frame #21: 0x00000001000d2084 app`tao::platform_impl::platform::app_state::EventLoopHandler<T>::with_callback(self=0x0000000106de92e0, f=tao::platform_impl::platform::app_state::{impl#3}::handle_nonuser_event::{closure_env#0}<app::event::Event> @ 0x000000016fded268) at app_state.rs:79:7
    frame #22: 0x00000001000d11bc app`<tao::platform_impl::platform::app_state::EventLoopHandler<T> as tao::platform_impl::platform::app_state::EventHandler>::handle_nonuser_event(self=0x0000000106de92e0, event=<unavailable>, control_flow=0x00000001034c0728) at app_state.rs:100:5
    frame #23: 0x0000000101cb3b98 app`tao::platform_impl::platform::app_state::Handler::handle_nonuser_event(self=0x00000001034c0718, wrapper=tao::platform_impl::platform::event::EventWrapper::StaticEvent @ 0x000000016fded898) at app_state.rs:208:11
    frame #24: 0x0000000101cb51fc app`tao::platform_impl::platform::app_state::AppState::cleared(panic_info=(refs:2,weak:3) {...}) at app_state.rs:387:5
    frame #25: 0x0000000101cc4e90 app`tao::platform_impl::platform::observer::control_flow_end_handler::{{closure}}(panic_info=(refs:2,weak:3) {...}) at observer.rs:187:11
    frame #26: 0x0000000101cc4c68 app`tao::platform_impl::platform::observer::control_flow_handler::{{closure}} at observer.rs:148:5
    frame #27: 0x0000000101cc271c app`std::panicking::try::do_call(data=0x000000016fdede68) at panicking.rs:500:40
    frame #28: 0x0000000101cc5564 app`__rust_try + 32
    frame #29: 0x0000000101cc25dc app`std::panicking::try(f=tao::platform_impl::platform::observer::control_flow_handler::{closure_env#0}<tao::platform_impl::platform::observer::control_flow_end_handler::{closure_env#0}> @ 0x000000016fdede88) at panicking.rs:464:19
    frame #30: 0x0000000101cc2278 app`std::panic::catch_unwind(f=tao::platform_impl::platform::observer::control_flow_handler::{closure_env#0}<tao::platform_impl::platform::observer::control_flow_end_handler::{closure_env#0}> @ 0x000000016fdeded0) at panic.rs:142:14
    frame #31: 0x0000000101ca3994 app`tao::platform_impl::platform::event_loop::stop_app_on_panic(panic_info=(refs:2,weak:3) {...}, f=tao::platform_impl::platform::observer::control_flow_handler::{closure_env#0}<tao::platform_impl::platform::observer::control_flow_end_handler::{closure_env#0}> @ 0x000000016fdee0d8) at event_loop.rs:259:9
    frame #32: 0x0000000101cc4bf8 app`tao::platform_impl::platform::observer::control_flow_handler(panic_info=0x0000000105f0a5b0, f=tao::platform_impl::platform::observer::control_flow_end_handler::{closure_env#0} @ 0x000000016fdee2e8) at observer.rs:146:3
    frame #33: 0x0000000101cc4e08 app`tao::platform_impl::platform::observer::control_flow_end_handler((null)=0x0000000105f0b110, activity=32, panic_info=0x0000000105f0a5b0) at observer.rs:182:5
    frame #34: 0x00000001a82119f0 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36
    frame #35: 0x00000001a82118dc CoreFoundation`__CFRunLoopDoObservers + 532
    frame #36: 0x00000001a8211010 CoreFoundation`__CFRunLoopRun + 1028
    frame #37: 0x00000001a82104b8 CoreFoundation`CFRunLoopRunSpecific + 612
    frame #38: 0x00000001b1a62df0 HIToolbox`RunCurrentEventLoopInMode + 292
    frame #39: 0x00000001b1a62c2c HIToolbox`ReceiveNextEventCommon + 648
    frame #40: 0x00000001b1a62984 HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 76
    frame #41: 0x00000001ab43797c AppKit`_DPSNextEvent + 636
    frame #42: 0x00000001ab436b18 AppKit`-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 716
    frame #43: 0x00000001ab42af7c AppKit`-[NSApplication run] + 464
    frame #44: 0x00000001006d3a28 app`<() as objc::message::MessageArguments>::invoke(imp=0x00000001a7d99c00, obj=0x0000000105f13150, sel=objc::runtime::Sel @ 0x000000016fdef818, (null)=()) at mod.rs:128:17
    frame #45: 0x00000001006de458 app`objc::message::platform::send_unverified(obj=0x0000000105f13150, sel=objc::runtime::Sel @ 0x000000016fdef880, args=()) at mod.rs:27:9
    frame #46: 0x0000000100585acc app`tao::platform_impl::platform::event_loop::EventLoop<T>::run_return [inlined] objc::message::send_message(obj=0x0000000105f13150, sel=objc::runtime::Sel @ 0x000000016fdefc18, args=<unavailable>) at mod.rs:178:5
    frame #47: 0x0000000100585ab8 app`tao::platform_impl::platform::event_loop::EventLoop<T>::run_return(self=0x000000016fdefcc8, callback=<unavailable>) at event_loop.rs:216:16
    frame #48: 0x0000000100587a14 app`tao::platform_impl::platform::event_loop::EventLoop<T>::run(self=<unavailable>, callback=<unavailable>) at event_loop.rs:183:21
    frame #49: 0x000000010025cb18 app`tao::event_loop::EventLoop<T>::run(self=<unavailable>, event_handler=app::webview::{impl#0}::run::{async_fn#0}::{closure_env#3} @ 0x000000016fdf3060) at event_loop.rs:212:5
    frame #50: 0x00000001005efe50 app`app::webview::WebviewManager::run::{{closure}}((null)=0x000000016fdf94a8) at mod.rs:341:9
    frame #51: 0x0000000100202014 app`app::main::{{closure}}((null)=0x000000016fdf94a8) at main.rs:316:27
    frame #52: 0x00000001002c4c04 app`tokio::runtime::park::CachedParkThread::block_on::{{closure}} at park.rs:282:63
    frame #53: 0x00000001002c42ac app`tokio::runtime::park::CachedParkThread::block_on at coop.rs:107:5
    frame #54: 0x00000001002c4248 app`tokio::runtime::park::CachedParkThread::block_on [inlined] tokio::runtime::coop::budget(f=tokio::runtime::park::{impl#4}::block_on::{closure_env#0}<app::main::{async_block_env#0}> @ 0x000000016fdf9e18) at coop.rs:73:5
    frame #55: 0x00000001002c41cc app`tokio::runtime::park::CachedParkThread::block_on(self=0x000000016fdf9eb7, f=app::main::{async_block_env#0}::Unresumed @ 0x000000016fdf9eb8) at park.rs:282:31
    frame #56: 0x00000001005df804 app`tokio::runtime::context::blocking::BlockingRegionGuard::block_on(self=0x000000016fdfb190, f=app::main::{async_block_env#0}::Unresumed @ 0x000000016fdfa810) at blocking.rs:66:9
    frame #57: 0x0000000100216b50 app`tokio::runtime::scheduler::multi_thread::MultiThread::block_on::{{closure}}(blocking=0x000000016fdfb190) at mod.rs:87:13
    frame #58: 0x00000001002ad020 app`tokio::runtime::context::runtime::enter_runtime(handle=0x000000016fdfe058, allow_block_in_place=true, f=tokio::runtime::scheduler::multi_thread::{impl#0}::block_on::{closure_env#0}<app::main::{async_block_env#0}> @ 0x000000016fdfbb38) at runtime.rs:65:16
    frame #59: 0x0000000100216afc app`tokio::runtime::scheduler::multi_thread::MultiThread::block_on(self=0x000000016fdfe030, handle=0x000000016fdfe058, future=<unavailable>) at mod.rs:86:9
    frame #60: 0x000000010044fe14 app`tokio::runtime::runtime::Runtime::block_on(self=0x000000016fdfe028, future=app::main::{async_block_env#0}::Unresumed @ 0x000000016fdfe190) at runtime.rs:349:45
    frame #61: 0x000000010063ca90 app`app::main at main.rs:316:5
    frame #62: 0x000000010046dd80 app`core::ops::function::FnOnce::call_once((null)=0x000000010063c9a0, (null)=()) at function.rs:250:5
    frame #63: 0x000000010061887c app`std::sys_common::backtrace::__rust_begin_short_backtrace(f=0x000000010063c9a0) at backtrace.rs:135:18
    frame #64: 0x0000000100560104 app`std::rt::lang_start::{{closure}} at rt.rs:166:18
    frame #65: 0x000000010244c8e0 app`std::rt::lang_start_internal [inlined] core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once at function.rs:284:13 [opt]
    frame #66: 0x000000010244c8d8 app`std::rt::lang_start_internal [inlined] std::panicking::try::do_call at panicking.rs:500:40 [opt]
    frame #67: 0x000000010244c8d8 app`std::rt::lang_start_internal [inlined] std::panicking::try at panicking.rs:464:19 [opt]
    frame #68: 0x000000010244c8d8 app`std::rt::lang_start_internal [inlined] std::panic::catch_unwind at panic.rs:142:14 [opt]
    frame #69: 0x000000010244c8d8 app`std::rt::lang_start_internal [inlined] std::rt::lang_start_internal::{{closure}} at rt.rs:148:48 [opt]
    frame #70: 0x000000010244c8d8 app`std::rt::lang_start_internal [inlined] std::panicking::try::do_call at panicking.rs:500:40 [opt]
    frame #71: 0x000000010244c8d4 app`std::rt::lang_start_internal [inlined] std::panicking::try at panicking.rs:464:19 [opt]
    frame #72: 0x000000010244c8d4 app`std::rt::lang_start_internal [inlined] std::panic::catch_unwind at panic.rs:142:14 [opt]
    frame #73: 0x000000010244c8d4 app`std::rt::lang_start_internal at rt.rs:148:20 [opt]
    frame #74: 0x00000001005600d0 app`std::rt::lang_start(main=0x000000010063c9a0, argc=1, argv=0x000000016fdfef18, sigpipe=0) at rt.rs:165:17
    frame #75: 0x000000010063cb20 app`main + 36
    frame #76: 0x00000001a7ddbf28 dyld`start + 2236

Might be because of bdd0c9a
could you try v0.9.2? hopefully it won't crash due to another bug.

Nope, that still didn't work, I also got this on stderr when it crashed:

app[35903:2336764] *** Assertion failure in -[NSMenu dealloc], NSMenu.m:409

Backtrace:

* thread #1, name = 'main', queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x10)
  * frame #0: 0x00000001a7d99c20 libobjc.A.dylib`objc_msgSend + 32
    frame #1: 0x0000000102181a7c app`<() as objc::message::MessageArguments>::invoke(imp=0x00000001a7d99c00, obj=0x00000001068da960, sel=objc::runtime::Sel @ 0x000000016fde2fd8, (null)=()) at mod.rs:128:17
    frame #2: 0x0000000102180da8 app`objc::message::platform::send_unverified(obj=0x00000001068da960, sel=objc::runtime::Sel @ 0x000000016fde3040, args=()) at mod.rs:27:9
    frame #3: 0x0000000100b7d9ec app`<muda::platform_impl::platform::NsMenuRef as core::ops::drop::Drop>::drop [inlined] objc::message::send_message(obj=0x00000001068da960, sel=objc::runtime::Sel @ 0x000000016fde31a0, args=<unavailable>) at mod.rs:178:5
    frame #4: 0x0000000100b7d9d8 app`<muda::platform_impl::platform::NsMenuRef as core::ops::drop::Drop>::drop(self=0x000000010689a510) at mod.rs:56:25
    frame #5: 0x0000000100b8f0e0 app`core::ptr::drop_in_place<muda::platform_impl::platform::NsMenuRef>((null)=0x000000010689a510) at mod.rs:497:1
    frame #6: 0x0000000100b8f618 app`core::ptr::drop_in_place<[muda::platform_impl::platform::NsMenuRef]>((null)=*mut [muda::platform_impl::platform::NsMenuRef] @ 0x000000016fde32d0) at mod.rs:497:1
    frame #7: 0x0000000100b87c38 app`<alloc::vec::Vec<T,A> as core::ops::drop::Drop>::drop(self=(1) vec![{...}]) at mod.rs:3013:13
    frame #8: 0x0000000100b8fa48 app`core::ptr::drop_in_place<alloc::vec::Vec<muda::platform_impl::platform::NsMenuRef>>((null)=(1) vec![{...}]) at mod.rs:497:1
    frame #9: 0x0000000100b900d8 app`core::ptr::drop_in_place<(u32,alloc::vec::Vec<muda::platform_impl::platform::NsMenuRef>)>((null)=(31, (1) vec![{...}])) at mod.rs:497:1
    frame #10: 0x0000000100b9d5c8 app`hashbrown::raw::Bucket<T>::drop [inlined] core::ptr::mut_ptr::<impl *mut T>::drop_in_place(self=(31, (1) vec![{...}])) at mut_ptr.rs:1431:18
    frame #11: 0x0000000100b9d5c0 app`hashbrown::raw::Bucket<T>::drop(self=0x000000016fde34e8) at mod.rs:581:23
    frame #12: 0x0000000100b9de10 app`hashbrown::raw::RawTable<T,A>::drop_elements(self=0x00000001068dd7d0) at mod.rs:1038:17
    frame #13: 0x0000000100b9d238 app`<hashbrown::raw::RawTable<T,A> as core::ops::drop::Drop>::drop(self=0x00000001068dd7d0) at mod.rs:2699:17
    frame #14: 0x0000000100b8df7c app`core::ptr::drop_in_place<hashbrown::raw::RawTable<(u32,alloc::vec::Vec<muda::platform_impl::platform::NsMenuRef>)>>((null)=0x00000001068dd7d0) at mod.rs:497:1
    frame #15: 0x0000000100b8e390 app`core::ptr::drop_in_place<hashbrown::map::HashMap<u32,alloc::vec::Vec<muda::platform_impl::platform::NsMenuRef>,std::collections::hash::map::RandomState>>((null)=0x00000001068dd7d0) at mod.rs:497:1
    frame #16: 0x0000000100b8dffc app`core::ptr::drop_in_place<std::collections::hash::map::HashMap<u32,alloc::vec::Vec<muda::platform_impl::platform::NsMenuRef>>>((null)=size=1, capacity=4) at mod.rs:497:1
    frame #17: 0x0000000100b8e374 app`core::ptr::drop_in_place<core::option::Option<std::collections::hash::map::HashMap<u32,alloc::vec::Vec<muda::platform_impl::platform::NsMenuRef>>>>((null)=RandomState>>{...}) at mod.rs:497:1
    frame #18: 0x0000000100b8f088 app`core::ptr::drop_in_place<muda::platform_impl::platform::MenuChild>((null)=0x00000001068dd608) at mod.rs:497:1
    frame #19: 0x0000000100b8ff5c app`core::ptr::drop_in_place<core::cell::UnsafeCell<muda::platform_impl::platform::MenuChild>>((null)=0x00000001068dd608) at mod.rs:497:1
    frame #20: 0x0000000100b8fe60 app`core::ptr::drop_in_place<core::cell::RefCell<muda::platform_impl::platform::MenuChild>>((null)={...}) at mod.rs:497:1
    frame #21: 0x0000000100b95dac app`<alloc::rc::Rc<T> as core::ops::drop::Drop>::drop(self=(refs:0,weak:1) <disposed>) at rc.rs:1607:17
    frame #22: 0x0000000100b8db7c app`core::ptr::drop_in_place<alloc::rc::Rc<core::cell::RefCell<muda::platform_impl::platform::MenuChild>>>((null)=(refs:0,weak:1) <disposed>) at mod.rs:497:1
    frame #23: 0x0000000100b8dd4c app`core::ptr::drop_in_place<[alloc::rc::Rc<core::cell::RefCell<muda::platform_impl::platform::MenuChild>>]>((null)=*mut [alloc::rc::Rc<core::cell::RefCell<muda::platform_impl::platform::MenuChild>>] @ 0x000000016fde3820) at mod.rs:497:1
    frame #24: 0x0000000100b87bd0 app`<alloc::vec::Vec<T,A> as core::ops::drop::Drop>::drop(self=(13) vec![(refs:4404878544,weak:-1) (borrowed:36) {...}, ...]) at mod.rs:3013:13
    frame #25: 0x0000000100b8dfa4 app`core::ptr::drop_in_place<alloc::vec::Vec<alloc::rc::Rc<core::cell::RefCell<muda::platform_impl::platform::MenuChild>>>>((null)=(13) vec![(refs:4404878544,weak:-1) (borrowed:36) {...}, ...]) at mod.rs:497:1
    frame #26: 0x0000000100b8ee04 app`core::ptr::drop_in_place<muda::platform_impl::platform::Menu>((null)=0x00000001068f13b8) at mod.rs:497:1
    frame #27: 0x0000000100b8fc54 app`core::ptr::drop_in_place<core::cell::UnsafeCell<muda::platform_impl::platform::Menu>>((null)=0x00000001068f13b8) at mod.rs:497:1
    frame #28: 0x0000000100b8f978 app`core::ptr::drop_in_place<core::cell::RefCell<muda::platform_impl::platform::Menu>>((null)={...}) at mod.rs:497:1
    frame #29: 0x0000000100b95fd0 app`<alloc::rc::Rc<T> as core::ops::drop::Drop>::drop(self=(refs:0,weak:1) <disposed>) at rc.rs:1607:17
    frame #30: 0x0000000100b8dab0 app`core::ptr::drop_in_place<alloc::rc::Rc<core::cell::RefCell<muda::platform_impl::platform::Menu>>>((null)=(refs:0,weak:1) <disposed>) at mod.rs:497:1
    frame #31: 0x0000000100b8e628 app`core::ptr::drop_in_place<muda::menu::Menu>((null)=0x000000010688c990) at mod.rs:497:1
    frame #32: 0x0000000100b7c0c0 app`core::ptr::drop_in_place<alloc::boxed::Box<dyn muda::ContextMenu>>((null)=0x000000016bb2ccc8) at mod.rs:497:1
    frame #33: 0x0000000100b7c590 app`core::ptr::drop_in_place<core::option::Option<alloc::boxed::Box<dyn muda::ContextMenu>>>((null)=Global>>{...}) at mod.rs:497:1
    frame #34: 0x0000000100b74bc4 app`tray_icon::platform_impl::platform::TrayIcon::set_menu(self=0x000000016bb2cc88, menu=Some({...})) at mod.rs:138:9
    frame #35: 0x0000000100b730d0 app`tray_icon::TrayIcon::set_menu(self=0x000000016bb337a0, menu=Some({...})) at lib.rs:339:9
    frame #36: 0x00000001003ba1b0 app`app::webview::WebviewManager::run::{{closure}}::{{closure}}(event=tao::event::Event<app::event::Event>::MainEventsCleared @ 0x000000016fdec7e0, window_target=0x0000000106e41520, control_flow=0x00000001034bc740) at mod.rs:349:17
    frame #37: 0x00000001001ff798 app`<tao::platform_impl::platform::app_state::EventLoopHandler<T> as tao::platform_impl::platform::app_state::EventHandler>::handle_nonuser_event::{{closure}}(this=0x000000016bb330a0, callback={...}) at app_state.rs:105:9
    frame #38: 0x00000001001ffe64 app`tao::platform_impl::platform::app_state::EventLoopHandler<T>::with_callback(self=0x000000016bb330a0, f=tao::platform_impl::platform::app_state::{impl#3}::handle_nonuser_event::{closure_env#0}<app::event::Event> @ 0x000000016fdecc08) at app_state.rs:79:7
    frame #39: 0x00000001001ff20c app`<tao::platform_impl::platform::app_state::EventLoopHandler<T> as tao::platform_impl::platform::app_state::EventHandler>::handle_nonuser_event(self=0x000000016bb330a0, event=<unavailable>, control_flow=0x00000001034bc740) at app_state.rs:100:5
    frame #40: 0x0000000101cb0a18 app`tao::platform_impl::platform::app_state::Handler::handle_nonuser_event(self=0x00000001034bc730, wrapper=tao::platform_impl::platform::event::EventWrapper::StaticEvent @ 0x000000016fded238) at app_state.rs:208:11
    frame #41: 0x0000000101cb207c app`tao::platform_impl::platform::app_state::AppState::cleared(panic_info=(refs:2,weak:3) {...}) at app_state.rs:387:5
    frame #42: 0x0000000101cc1d10 app`tao::platform_impl::platform::observer::control_flow_end_handler::{{closure}}(panic_info=(refs:2,weak:3) {...}) at observer.rs:187:11
    frame #43: 0x0000000101cc1ae8 app`tao::platform_impl::platform::observer::control_flow_handler::{{closure}} at observer.rs:148:5
    frame #44: 0x0000000101cbf59c app`std::panicking::try::do_call(data=0x000000016fded808) at panicking.rs:500:40
    frame #45: 0x0000000101cc23e4 app`__rust_try + 32
    frame #46: 0x0000000101cbf45c app`std::panicking::try(f=tao::platform_impl::platform::observer::control_flow_handler::{closure_env#0}<tao::platform_impl::platform::observer::control_flow_end_handler::{closure_env#0}> @ 0x000000016fded828) at panicking.rs:464:19
    frame #47: 0x0000000101cbf0f8 app`std::panic::catch_unwind(f=tao::platform_impl::platform::observer::control_flow_handler::{closure_env#0}<tao::platform_impl::platform::observer::control_flow_end_handler::{closure_env#0}> @ 0x000000016fded870) at panic.rs:142:14
    frame #48: 0x0000000101ca0814 app`tao::platform_impl::platform::event_loop::stop_app_on_panic(panic_info=(refs:2,weak:3) {...}, f=tao::platform_impl::platform::observer::control_flow_handler::{closure_env#0}<tao::platform_impl::platform::observer::control_flow_end_handler::{closure_env#0}> @ 0x000000016fdeda78) at event_loop.rs:259:9
    frame #49: 0x0000000101cc1a78 app`tao::platform_impl::platform::observer::control_flow_handler(panic_info=0x0000000106e27640, f=tao::platform_impl::platform::observer::control_flow_end_handler::{closure_env#0} @ 0x000000016fdedc88) at observer.rs:146:3
    frame #50: 0x0000000101cc1c88 app`tao::platform_impl::platform::observer::control_flow_end_handler((null)=0x0000000106e25cb0, activity=32, panic_info=0x0000000106e27640) at observer.rs:182:5
    frame #51: 0x00000001a82119f0 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36
    frame #52: 0x00000001a82118dc CoreFoundation`__CFRunLoopDoObservers + 532
    frame #53: 0x00000001a8211010 CoreFoundation`__CFRunLoopRun + 1028
    frame #54: 0x00000001a82104b8 CoreFoundation`CFRunLoopRunSpecific + 612
    frame #55: 0x00000001b1a62df0 HIToolbox`RunCurrentEventLoopInMode + 292
    frame #56: 0x00000001b1a62c2c HIToolbox`ReceiveNextEventCommon + 648
    frame #57: 0x00000001b1a62984 HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 76
    frame #58: 0x00000001ab43797c AppKit`_DPSNextEvent + 636
    frame #59: 0x00000001ab436b18 AppKit`-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 716
    frame #60: 0x00000001ab42af7c AppKit`-[NSApplication run] + 464
    frame #61: 0x00000001006d3200 app`<() as objc::message::MessageArguments>::invoke(imp=0x00000001a7d99c00, obj=0x0000000106e2af90, sel=objc::runtime::Sel @ 0x000000016fdef1b8, (null)=()) at mod.rs:128:17
    frame #62: 0x00000001006ddc30 app`objc::message::platform::send_unverified(obj=0x0000000106e2af90, sel=objc::runtime::Sel @ 0x000000016fdef220, args=()) at mod.rs:27:9
    frame #63: 0x00000001005207a4 app`tao::platform_impl::platform::event_loop::EventLoop<T>::run_return [inlined] objc::message::send_message(obj=0x0000000106e2af90, sel=objc::runtime::Sel @ 0x000000016fdef5b8, args=<unavailable>) at mod.rs:178:5
    frame #64: 0x0000000100520790 app`tao::platform_impl::platform::event_loop::EventLoop<T>::run_return(self=0x000000016fdef668, callback=<unavailable>) at event_loop.rs:216:16
    frame #65: 0x0000000100522004 app`tao::platform_impl::platform::event_loop::EventLoop<T>::run(self=<unavailable>, callback=<unavailable>) at event_loop.rs:183:21
    frame #66: 0x00000001006ba86c app`tao::event_loop::EventLoop<T>::run(self=<unavailable>, event_handler=app::webview::{impl#0}::run::{async_fn#0}::{closure_env#3} @ 0x000000016fdf2f20) at event_loop.rs:212:5
    frame #67: 0x00000001003b6be4 app`app::webview::WebviewManager::run::{{closure}}((null)=0x000000016fdf94a8) at mod.rs:341:9
    frame #68: 0x00000001001e60e4 app`app::main::{{closure}}((null)=0x000000016fdf94a8) at main.rs:316:27
    frame #69: 0x00000001001ed840 app`tokio::runtime::park::CachedParkThread::block_on::{{closure}} at park.rs:282:63
    frame #70: 0x00000001001ed2fc app`tokio::runtime::park::CachedParkThread::block_on at coop.rs:107:5
    frame #71: 0x00000001001ed298 app`tokio::runtime::park::CachedParkThread::block_on [inlined] tokio::runtime::coop::budget(f=tokio::runtime::park::{impl#4}::block_on::{closure_env#0}<app::main::{async_block_env#0}> @ 0x000000016fdf9e18) at coop.rs:73:5
    frame #72: 0x00000001001ed21c app`tokio::runtime::park::CachedParkThread::block_on(self=0x000000016fdf9eb7, f=app::main::{async_block_env#0}::Unresumed @ 0x000000016fdf9eb8) at park.rs:282:31
    frame #73: 0x000000010053c994 app`tokio::runtime::context::blocking::BlockingRegionGuard::block_on(self=0x000000016fdfb190, f=app::main::{async_block_env#0}::Unresumed @ 0x000000016fdfa810) at blocking.rs:66:9
    frame #74: 0x000000010004484c app`tokio::runtime::scheduler::multi_thread::MultiThread::block_on::{{closure}}(blocking=0x000000016fdfb190) at mod.rs:87:13
    frame #75: 0x00000001001c25a8 app`tokio::runtime::context::runtime::enter_runtime(handle=0x000000016fdfe058, allow_block_in_place=true, f=tokio::runtime::scheduler::multi_thread::{impl#0}::block_on::{closure_env#0}<app::main::{async_block_env#0}> @ 0x000000016fdfbb38) at runtime.rs:65:16
    frame #76: 0x00000001000447f8 app`tokio::runtime::scheduler::multi_thread::MultiThread::block_on(self=0x000000016fdfe030, handle=0x000000016fdfe058, future=<unavailable>) at mod.rs:86:9
    frame #77: 0x00000001001c3fd8 app`tokio::runtime::runtime::Runtime::block_on(self=0x000000016fdfe028, future=app::main::{async_block_env#0}::Unresumed @ 0x000000016fdfe190) at runtime.rs:349:45
    frame #78: 0x0000000100011a8c app`app::main at main.rs:316:5
    frame #79: 0x00000001003e04cc app`core::ops::function::FnOnce::call_once((null)=0x000000010001199c, (null)=()) at function.rs:250:5
    frame #80: 0x00000001001ba0cc app`std::sys_common::backtrace::__rust_begin_short_backtrace(f=0x000000010001199c) at backtrace.rs:135:18
    frame #81: 0x0000000100566c8c app`std::rt::lang_start::{{closure}} at rt.rs:166:18
    frame #82: 0x0000000102449760 app`std::rt::lang_start_internal [inlined] core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once at function.rs:284:13 [opt]
    frame #83: 0x0000000102449758 app`std::rt::lang_start_internal [inlined] std::panicking::try::do_call at panicking.rs:500:40 [opt]
    frame #84: 0x0000000102449758 app`std::rt::lang_start_internal [inlined] std::panicking::try at panicking.rs:464:19 [opt]
    frame #85: 0x0000000102449758 app`std::rt::lang_start_internal [inlined] std::panic::catch_unwind at panic.rs:142:14 [opt]
    frame #86: 0x0000000102449758 app`std::rt::lang_start_internal [inlined] std::rt::lang_start_internal::{{closure}} at rt.rs:148:48 [opt]
    frame #87: 0x0000000102449758 app`std::rt::lang_start_internal [inlined] std::panicking::try::do_call at panicking.rs:500:40 [opt]
    frame #88: 0x0000000102449754 app`std::rt::lang_start_internal [inlined] std::panicking::try at panicking.rs:464:19 [opt]
    frame #89: 0x0000000102449754 app`std::rt::lang_start_internal [inlined] std::panic::catch_unwind at panic.rs:142:14 [opt]
    frame #90: 0x0000000102449754 app`std::rt::lang_start_internal at rt.rs:148:20 [opt]
    frame #91: 0x0000000100566c58 app`std::rt::lang_start(main=0x000000010001199c, argc=1, argv=0x000000016fdfef18, sigpipe=0) at rt.rs:165:17
    frame #92: 0x0000000100011b1c app`main + 36
    frame #93: 0x00000001a7ddbf28 dyld`start + 2236

@grant0417
Thanks for the report, but I couldn't reproduce it with the tao example in tray-icon. Could you provide a reproducible repo? That would be really helpful!

@pewsheen We are also facing this issue in dioxus on MacOS. Here is a reproduction repo https://github.com/ealmloff/muda-segfault

Looks like we need to retain the separator when we create it, somehow it was autoreleased before we drop it.

And it make sense #147 why it dereference to a null pointer here