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

There is on very rare occasions a case where a panic occurred at line 152 of layers.rs #4179

Closed
rustbasic opened this issue Mar 16, 2024 · 2 comments · Fixed by #4868
Closed
Labels
bug Something is broken

Comments

@rustbasic
Copy link
Contributor

rustbasic commented Mar 16, 2024

There is on very rare occasions a case where a panic occurred at line 152 of layers.rs when a Viewport exit.
( At this time, self.0.len() == 0 )

( On screens with different pixels_per_point. )

thread 'main' panicked at C:\prog\egui\crates\egui\src\layers.rs:152:15:
index out of bounds: the len is 0 but the index is 0

@rustbasic rustbasic added the bug Something is broken label Mar 16, 2024
@rustbasic rustbasic changed the title There is on very rare occasions a case where a panic occurred at line 152 of layers.rs when a Viewport exit. There is on very rare occasions a case where a panic occurred at line 152 of layers.rs Mar 20, 2024
@emilk
Copy link
Owner

emilk commented Mar 29, 2024

Please run with RUST_BACKTRACE=1 so we get a stack trace to the error

@rustbasic
Copy link
Contributor Author

Please run with RUST_BACKTRACE=1 so we get a stack trace to the error

On monitors with different pixels_per_point, this symptom sometimes appears when request_repaint() is continuously called and the Viewport is continuously moved, so it does not appear easily.
I will post the report when I get it.

@emilk emilk closed this as completed in 1474c17 Sep 17, 2024
hacknus pushed a commit to hacknus/egui that referenced this issue Oct 30, 2024
…per_point (emilk#4868)

Fix: panic when dragging window between monitors of different
pixels_per_point

This will continue to help us as we develop `egui`.
I hope you agree with my defense of `panic`.

* Relate emilk#3959
* Relate emilk#4088

* Closes emilk#4178
* Closes emilk#4179


There is also a way to add log if necessary.
```
                log::debug!("Anti-panic behavior occurs");
```

---------

Co-authored-by: Emil Ernerfeldt <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken
Projects
None yet
2 participants