Порівняти коміти

...
Автор SHA1 Повідомлення Дата
l0ng-ai d804cee580 fix(updates): don't hold the update lock while asking which window is focused
The automatic update announcement held updates.ready while asking a window
whether it is focused, which waits for the main thread. A window starting up
at the same time calls app_update_window_ready on the main thread, which takes
updates.ready: both waited on each other and the app froze with no window.
Read the focused and live windows first, then take the lock.

Fixes #4496
2026-11-19 20:59:23 +08:00
+5 -2
Переглянути файл
@@ -139,11 +139,14 @@ fn announce_available(app: &AppHandle) {
return;
}
let state = app.state::<AppState>();
// Asking a window whether it is focused waits for the main thread, where
// `app_update_window_ready` takes `ready`: never hold the lock across it.
let focused = crate::windows::target_window(app);
let live = crate::windows::project_window_labels(app);
let owner = {
let mut ready = state.updates.ready.lock();
ready.retain(|label| app.get_webview_window(label).is_some());
let focused = crate::windows::target_window(app);
ready_owner(focused.as_ref().map(|window| window.label()), &crate::windows::project_window_labels(app), &ready)
ready_owner(focused.as_ref().map(|window| window.label()), &live, &ready)
};
let Some(owner) = owner else { return };
let update = {