Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The examples crash if you minimize the window #20

Open
takahirox opened this issue Oct 7, 2021 · 1 comment · May be fixed by #27
Open

The examples crash if you minimize the window #20

takahirox opened this issue Oct 7, 2021 · 1 comment · May be fixed by #27
Labels
bug Something isn't working examples

Comments

@takahirox
Copy link
Owner

The examples crash if you minimize the window.

How to reproduce

  1. $ cargo run --example triangle
  2. Minimize the window
  3. Crashes

The error log

thread 'main' panicked at 'Error in Surface::configure: Both `Surface` width and height must be non-zero. Wait to recreate the `Surface` until the window has non-zero area.', C:\Users\Takahiro\.cargo\git\checkouts\wgpu-53e70f8674b08dd4\c3d9068\wgpu\src\backend\direct.rs:197:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: process didn't exit successfully: `target\debug\examples\rotation.exe` (exit code: 101)
@takahirox takahirox added bug Something isn't working examples labels Oct 7, 2021
@michalusio
Copy link

michalusio commented Jul 23, 2022

Hi!

The bug is happening because minimizing the window sends a Resize event with size (0, 0) which crashes the Surface configuration.

That can be fixed by either checking the size in the example and not changing the surface's size (and probably not rendering while minimized?) or it could be handled by the library itself.

If you want to, I can take a look and add a "minimized" flag to the renderer that would handle resizing to (0, 0), and would not render while minimized.

@michalusio michalusio linked a pull request Jul 23, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working examples
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants