On Wayland, fix rare crash on DPI change

While I don't understand the root cause for this issue, we can
dirty fix like that for now.
This commit is contained in:
Kirill Chibisov 2023-02-19 17:39:39 +03:00 committed by GitHub
parent 82df9531f4
commit 0f89aac9f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View file

@ -10,6 +10,7 @@ And please only add new entries to the top of this list, right below the `# Unre
- Implement `HasRawDisplayHandle` for `EventLoop`.
- On macOS, set resize increments only for live resizes.
- On Wayland, fix rare crash on DPI change
# 0.28.1

View file

@ -128,6 +128,12 @@ impl Window {
let surface = event_loop_window_target
.env
.create_surface_with_scale_callback(move |scale, surface, mut dispatch_data| {
// While I'm not sure how this could happen, we can safely ignore it
// for now as a quickfix.
if !surface.as_ref().is_alive() {
return;
}
let winit_state = dispatch_data.get::<WinitState>().unwrap();
// Get the window that received the event.