Skip to content

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

Closed

Description

@ktff

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/github.com-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/github.com-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/github.com-1ecc6299db9ec823/winit-0.7.5/src/platform/linux/mod.rs:378
  14: winit::EventsLoop::poll_events
             at /home/ktf/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.7.5/src/lib.rs:219

Activity

  1. added
    DS - x11
    on Aug 15, 2017
  2. francesca64 commented on Mar 23, 2018

    @francesca64
    Member

    Fixed via #416

  3. added a commit that references this issue on Jan 5, 2022
  4. added a commit that references this issue on Jun 11, 2022
    c37cdda
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    DS - x11

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions