diff --git a/.changes/fix-create-tao-window.md b/.changes/fix-create-tao-window.md new file mode 100644 index 000000000..54defeb36 --- /dev/null +++ b/.changes/fix-create-tao-window.md @@ -0,0 +1,6 @@ +--- +"tauri": patch +"tauri-runtime-wry": patch +--- + +Fixes a panic when using the `create_tao_window` API. diff --git a/core/tauri-runtime-wry/src/lib.rs b/core/tauri-runtime-wry/src/lib.rs index dd22b74da..b4c278bf7 100644 --- a/core/tauri-runtime-wry/src/lib.rs +++ b/core/tauri-runtime-wry/src/lib.rs @@ -154,6 +154,7 @@ fn send_user_message(context: &Context, message: Message) -> &context.main_thread.window_target, message, UserMessageContext { + webview_id_map: context.webview_id_map.clone(), window_event_listeners: &context.window_event_listeners, global_shortcut_manager: context.main_thread.global_shortcut_manager.clone(), clipboard_manager: context.main_thread.clipboard_manager.clone(), @@ -2105,6 +2106,7 @@ pub struct EventLoopIterationContext<'a, T: UserEvent> { } struct UserMessageContext<'a> { + webview_id_map: WebviewIdStore, window_event_listeners: &'a WindowEventListeners, global_shortcut_manager: Arc>, clipboard_manager: Arc>, @@ -2121,6 +2123,7 @@ fn handle_user_message( web_context: &WebContextStore, ) -> RunIteration { let UserMessageContext { + webview_id_map, window_event_listeners, menu_event_listeners, global_shortcut_manager, @@ -2368,6 +2371,8 @@ fn handle_user_message( .unwrap() .insert(window_id, WindowMenuEventListeners::default()); + webview_id_map.insert(window.id(), window_id); + let w = Arc::new(window); windows.lock().expect("poisoned webview collection").insert( @@ -2698,6 +2703,7 @@ fn handle_event_loop( event_loop, message, UserMessageContext { + webview_id_map, window_event_listeners, global_shortcut_manager, clipboard_manager,