Skip to content

fix(menu): ensure init & drop is done on main thread#8582

Merged
lucasfernog merged 13 commits into
devfrom
fix/menu-init-drop-main-thread
Jan 31, 2024
Merged

fix(menu): ensure init & drop is done on main thread#8582
lucasfernog merged 13 commits into
devfrom
fix/menu-init-drop-main-thread

Conversation

@amrbashir

Copy link
Copy Markdown
Member

No description provided.

@amrbashir amrbashir requested a review from a team as a code owner January 11, 2024 02:10
@jamischarles

Copy link
Copy Markdown

@amrbashir Is there any special way I should run this? When I run this branch with a very basic main.rs from create_tauri I get a stackoverflow...

warning: `app` (lib) generated 4 warnings
    Finished dev [unoptimized + debuginfo] target(s) in 6.81s

thread 'main' has overflowed its stack
fatal runtime error: stack overflow

When I ran lldb I found this

Process 60268 stopped
* thread #1, name = 'main', queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x16f606d78)
    frame #0: 0x00000001007a1f90 tauri-notes-app`tauri_runtime_wry::handle_user_message::h5d6c144da76d1f73(event_loop=0x0000000000000001, message=<unavailable>, context=UserMessageContext @ 0x000000016f608150, web_context=0x0000000123700000) at lib.rs:2165
   2162      webview_id_map: WebviewIdStore,
   2163    }
   2164
-> 2165    fn handle_user_message<T: UserEvent>(
   2166      event_loop: &EventLoopWindowTarget<Message<T>>,
   2167      message: Message<T>,
   2168      context: UserMessageContext,
Target 0: (tauri-notes-app) stopped.
(lldb) frame variable
(tauri_runtime_wry::Message<tauri::EventLoopMessage>) message = <variable not available>

(tauri_runtime_wry::UserMessageContext) context = {
  windows = strong=0, weak=4889537407 {
    value = borrow=0 {
      value = size=0
    }
  }
  webview_id_map = {
    0 = strong=0, weak=18446744073709551615 {
      data = <read memory from 0x13 failed (0 of 64 bytes read)>

    }
  }
}
(alloc::sync::Arc<std::sync::mutex::Mutex<std::collections::hash::map::HashMap<core::option::Option<std::path::PathBuf>, wry::web_context::WebContext, std::collections::hash::map::RandomState> > > *) web_context = 0x0000000123700000

@lucasfernog

Copy link
Copy Markdown
Member

Doesn't really fix the issue but let's merge this anyway since this is a good approach to prevent weird behavior (and we won't be able to break the API later).

@lucasfernog lucasfernog merged commit e1eb911 into dev Jan 31, 2024
@lucasfernog lucasfernog deleted the fix/menu-init-drop-main-thread branch January 31, 2024 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants