piston-examples icon indicating copy to clipboard operation
piston-examples copied to clipboard

Closing window with mouse causes panic

Open milesand opened this issue 6 years ago • 2 comments

On Linux Mint 18.3 Cinnamon 64-bit, using rustc 1.27.0 and cargo 1.27.0.

Cloning the repository and running cargo run --bin (binary name), then closing the resulting window with mouse by clicking x results in the following panic:

thread 'main' panicked at 'Failed to close input method: XError { description: "BadDrawable (invalid Pixmap or Window parameter)", error_code: 9, request_code: 14, minor_code: 0 }', libcore/result.rs:945:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Running with RUST_BACKTRACE=1 results in the following stack backtrace:

stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at libstd/sys_common/backtrace.rs:71
             at libstd/sys_common/backtrace.rs:59
   2: std::panicking::default_hook::{{closure}}
             at libstd/panicking.rs:211
   3: std::panicking::default_hook
             at libstd/panicking.rs:227
   4: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:463
   5: std::panicking::begin_panic_fmt
             at libstd/panicking.rs:350
   6: rust_begin_unwind
             at libstd/panicking.rs:328
   7: core::panicking::panic_fmt
             at libcore/panicking.rs:71
   8: core::result::unwrap_failed
             at /checkout/src/libcore/macros.rs:26
   9: <core::result::Result<T, E>>::expect
             at /checkout/src/libcore/result.rs:809
  10: <winit::platform::platform::x11::util::Ime as core::ops::drop::Drop>::drop
             at /home/milesand/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.12.0/src/platform/linux/x11/util.rs:409
  11: core::ptr::drop_in_place
             at /checkout/src/libcore/ptr.rs:59
  12: core::ptr::drop_in_place
             at /checkout/src/libcore/ptr.rs:59
  13: <std::collections::hash::table::RawTable<K, V>>::rev_drop_buckets
             at /checkout/src/libstd/collections/hash/table.rs:889
  14: <std::collections::hash::table::RawTable<K, V> as core::ops::drop::Drop>::drop
             at /checkout/src/libstd/collections/hash/table.rs:1172
  15: core::ptr::drop_in_place
             at /checkout/src/libcore/ptr.rs:59
  16: core::ptr::drop_in_place
             at /checkout/src/libcore/ptr.rs:59
  17: core::ptr::drop_in_place
             at /checkout/src/libcore/ptr.rs:59
  18: core::ptr::drop_in_place
             at /checkout/src/libcore/ptr.rs:59
  19: core::ptr::drop_in_place
             at /checkout/src/libcore/ptr.rs:59
  20: core::ptr::drop_in_place
             at /checkout/src/libcore/ptr.rs:59
  21: core::ptr::drop_in_place
             at /checkout/src/libcore/ptr.rs:59
  22: core::ptr::drop_in_place
             at /checkout/src/libcore/ptr.rs:59
  23: core::ptr::drop_in_place
             at /checkout/src/libcore/ptr.rs:59
  24: sprite::main
             at src/sprite.rs:78
  25: std::rt::lang_start::{{closure}}
             at /checkout/src/libstd/rt.rs:74
  26: std::panicking::try::do_call
             at libstd/rt.rs:59
             at libstd/panicking.rs:310
  27: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:105
  28: std::rt::lang_start_internal
             at libstd/panicking.rs:289
             at libstd/panic.rs:374
             at libstd/rt.rs:58
  29: std::rt::lang_start
             at /checkout/src/libstd/rt.rs:74
  30: main
  31: __libc_start_main
  32: _start

Checked hello_world, draw_state, sprite and paint; All panics on click-closing. The rest are not tested.

milesand avatar Jul 09 '18 09:07 milesand

Happens to me in mint 19 tara, also.

jcbritobr avatar Aug 28 '18 18:08 jcbritobr

Same here:

  • Ubuntu 18.04
  • Gnome 3 on X11
  • Default window backend (which I assume is Glutin).

It could be something specific to the window backend, because if I use the SDL backend like:

let mut window: PistonWindow<Sdl2Window> = ...

Then I can't reproduce it anymore, closing with click and Esc works as expected.

mandx avatar Sep 15 '18 05:09 mandx