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

Panic in linux::x11::mod.rs::process_event #259

Closed
ktff opened this issue Aug 15, 2017 · 1 comment
Closed

Panic in linux::x11::mod.rs::process_event #259

ktff opened this issue Aug 15, 2017 · 1 comment
Labels

Comments

@ktff
Copy link

ktff commented Aug 15, 2017

Panic occurs in unwrap() for lines like

let window_data = windows.get_mut(&WindowId(xev.event)).unwrap()

It is caused by following events:

  1. Create Window with EventsLoop
  2. User creates some events (ex. mouse movement)
  3. Window is drooped
  4. Processing events on EventsLoop

Which creates situation where there are events waiting to be processed for a window that doesn't exist any more.

This is strictly minimal example. Real example creates new Window in step 3 and it doesn't matter if it's with old or new EventsLoop. Also moving 4. before 3. doesn't help because 2. can happen in between processing events and drooping Window.

I haven't looked if other platform implementations suffer from the same issue.

Quick and dirty fix would be to just ignore those events.
I am willing to implement this.

Relevant backtrace:

thread 'Updater[1]' panicked at 'called `Option::unwrap()` on a `None` value', /checkout/src/libcore/option.rs:335:20
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
             at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at /checkout/src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at /checkout/src/libstd/sys_common/backtrace.rs:60
             at /checkout/src/libstd/panicking.rs:380
   3: std::panicking::default_hook
             at /checkout/src/libstd/panicking.rs:396
   4: std::panicking::rust_panic_with_hook
             at /checkout/src/libstd/panicking.rs:610
   5: std::panicking::begin_panic
             at /checkout/src/libstd/panicking.rs:571
   6: std::panicking::begin_panic_fmt
             at /checkout/src/libstd/panicking.rs:521
   7: rust_begin_unwind
             at /checkout/src/libstd/panicking.rs:497
   8: core::panicking::panic_fmt
             at /checkout/src/libcore/panicking.rs:71
   9: core::panicking::panic
             at /checkout/src/libcore/panicking.rs:51
  10: <core::option::Option<T>>::unwrap
             at /checkout/src/libcore/macros.rs:22
  11: winit::platform::platform::x11::EventsLoop::process_event
             at /home/ktf/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/winit-0.7.5/src/platform/linux/x11/mod.rs:466
  12: winit::platform::platform::x11::EventsLoop::poll_events
             at /home/ktf/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/winit-0.7.5/src/platform/linux/x11/mod.rs:148
  13: winit::platform::platform::EventsLoop::poll_events
             at /home/ktf/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/winit-0.7.5/src/platform/linux/mod.rs:378
  14: winit::EventsLoop::poll_events
             at /home/ktf/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/winit-0.7.5/src/lib.rs:219
@francesca64
Copy link
Member

Fixed via #416

tmfink pushed a commit to tmfink/winit that referenced this issue Jan 5, 2022
madsmtm pushed a commit to madsmtm/winit that referenced this issue Jun 11, 2022
…ing#259 (rust-windowing#359)

* docs: document wayland behavior for `Moved` event, closes rust-windowing#259

* document outerposition
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants