Skip to content

Commit

Permalink
On Wayland, fix rare crash on DPI change
Browse files Browse the repository at this point in the history
While I don't understand the root cause for this issue, we can
dirty fix like that for now.
  • Loading branch information
kchibisov committed Mar 2, 2023
1 parent 811cc5c commit 0be08e5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions src/platform_impl/linux/wayland/window/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 0be08e5

Please sign in to comment.