mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-01 10:01:07 +02:00
refactor(wry): emit RunEvent::Exit on Event::LoopDestroyed (#3785)
This commit is contained in:
committed by
GitHub
parent
9489963e00
commit
3c4ee7c997
5
.changes/exit-loop-destroyed.md
Normal file
5
.changes/exit-loop-destroyed.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"tauri-runtime-wry": patch
|
||||
---
|
||||
|
||||
Emit `RunEvent::Exit` on `tao::event::Event::LoopDestroyed` instead of after `RunEvent::ExitRequested`.
|
||||
@@ -2300,14 +2300,10 @@ fn handle_event_loop<T: UserEvent>(
|
||||
#[cfg(feature = "system-tray")]
|
||||
tray_context,
|
||||
} = context;
|
||||
if *control_flow == ControlFlow::Exit {
|
||||
return RunIteration {
|
||||
window_count: windows.lock().expect("poisoned webview collection").len(),
|
||||
};
|
||||
if *control_flow != ControlFlow::Exit {
|
||||
*control_flow = ControlFlow::Wait;
|
||||
}
|
||||
|
||||
*control_flow = ControlFlow::Wait;
|
||||
|
||||
match event {
|
||||
Event::NewEvents(StartCause::Init) => {
|
||||
callback(RunEvent::Ready);
|
||||
@@ -2321,6 +2317,10 @@ fn handle_event_loop<T: UserEvent>(
|
||||
callback(RunEvent::MainEventsCleared);
|
||||
}
|
||||
|
||||
Event::LoopDestroyed => {
|
||||
callback(RunEvent::Exit);
|
||||
}
|
||||
|
||||
Event::GlobalShortcutEvent(accelerator_id) => {
|
||||
for (id, handler) in &*global_shortcut_manager_handle.listeners.lock().unwrap() {
|
||||
if accelerator_id == *id {
|
||||
@@ -2565,7 +2565,6 @@ fn on_window_close<'a, T: UserEvent>(
|
||||
|
||||
if !should_prevent {
|
||||
*control_flow = ControlFlow::Exit;
|
||||
callback(RunEvent::Exit);
|
||||
}
|
||||
}
|
||||
Some(webview)
|
||||
|
||||
Reference in New Issue
Block a user