zzzze / tauri-plugin-spotlight

37 stars 11 forks source link

Panic on startup on bundled app #7

Open lucanisi opened 2 months ago

lucanisi commented 2 months ago

Hi and thank you very much for developing this plugin!

Unfortunately, I am noticing a problem that occurs exclusively when I create the application's bundle (tested on MacOS aarch64). Launching the bundled application made with yarn tauri build seems to cause a panic.

While trying to reopen the application multiple times, in some cases the app starts correctly, but in most cases, it crashes.

To reproduce the issue, simply create a Tauri v1 project with only the plugin as a dependency, and bundle a release with yarn tauri build

[UPDATE] I'm trying to understand what's happening, and as an additional info, I noticed that even the debug mode panics when I directly execute the compiled application from finder.. e.g cargo run or yarn tauri dev make the app run succesfully, but the compiled executable generated by the command panics if I run it by double clicking over it or just running it from terminal

thread 'main' panicked at plugins/tauri-plugin-spotlight/spotlight_macos/panel.rs:140:29:
Uncaught exception <NSException: 0x60000059f7b0>

It seems that the crash is caused by panel.rs at this point:

pub(crate) fn set_collection_behaviour(&self, behaviour: NSWindowCollectionBehavior) {
    let _: () = unsafe { msg_send![self, setCollectionBehavior: behaviour] };
}

I am on a Mac Apple Silicon M2 and haven't had the chance to test on Intel

Thank you for your support!