summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2022-12-30 18:39:39 +0300
committerGitHub <noreply@github.com>2022-12-30 18:39:39 +0300
commitb77b9b3bcdc457e4b2557e55f9983ce36e40a903 (patch)
treea9552b46c2f1a03b05e70a9aa7f04215a66e0e9b
parenta49bd742925b36e4b6687ce28de3358da038b8a7 (diff)
downloadalacritty-b77b9b3bcdc457e4b2557e55f9983ce36e40a903.tar.gz
alacritty-b77b9b3bcdc457e4b2557e55f9983ce36e40a903.zip
Fix crash when one dimension of the window is zero
This fixes a crash on Windows when the user resizes the window to the point that it has the height of zero. The crash was introduced by the glutin update, since it requires non-zero sizes for the resize.
-rw-r--r--alacritty/src/event.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs
index 7cf77096..25d52e56 100644
--- a/alacritty/src/event.rs
+++ b/alacritty/src/event.rs
@@ -1176,11 +1176,10 @@ impl input::Processor<EventProxy, ActionContext<'_, Notifier, EventProxy>> {
match event {
WindowEvent::CloseRequested => self.ctx.terminal.exit(),
WindowEvent::Resized(size) => {
- // Minimizing the window sends a Resize event with zero width and
- // height. But there's no need to ever actually resize to this.
- // ConPTY has issues when resizing down to zero size and back.
- #[cfg(windows)]
- if size.width == 0 && size.height == 0 {
+ // Ignore resize events to zero in any dimension, to avoid issues with Winit
+ // and the ConPTY. A 0x0 resize will also occur when the window is minimized
+ // on Windows.
+ if size.width == 0 || size.height == 0 {
return;
}