sunjay / turtle

Create Animated Drawings in Rust
http://turtle.rs
Mozilla Public License 2.0
559 stars 54 forks source link

Linux X11 crash when mouse enters window or is moved #212

Closed enaut closed 3 years ago

enaut commented 3 years ago

Dear all, with all the examples I have tried the window closes and the program panics as soon as the mouse is moved inside the window.

the error:

thread 'main' panicked at 'attempted to leave type `platform::platform::x11::util::input::PointerState` uninitialized, which is invalid', /home/dietrich/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/mem/mod.rs:659:9

Somehow it seems that the mouse pointer is not initialized correctly.

the stack is:

thread 'main' panicked at 'attempted to leave type `platform::platform::x11::util::input::PointerState` uninitialized, which is invalid', /home/dietrich/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/mem/mod.rs:659:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/panicking.rs:483
   1: core::panicking::panic_fmt
             at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/core/src/panicking.rs:85
   2: core::panicking::panic
             at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/core/src/panicking.rs:50
   3: core::mem::uninitialized
             at /home/dietrich/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/mem/mod.rs:659
   4: winit::platform::platform::x11::util::input::<impl winit::platform::platform::x11::xdisplay::XConnection>::query_pointer
             at /home/dietrich/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.19.5/src/platform/linux/x11/util/input.rs:94
   5: winit::platform::platform::x11::EventsLoop::process_event
             at /home/dietrich/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.19.5/src/platform/linux/x11/mod.rs:956
   6: winit::platform::platform::x11::EventsLoop::poll_events
             at /home/dietrich/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.19.5/src/platform/linux/x11/mod.rs:270
   7: winit::platform::platform::EventsLoop::poll_events
             at /home/dietrich/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.19.5/src/platform/linux/mod.rs:522
   8: winit::EventsLoop::poll_events
             at /home/dietrich/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.19.5/src/lib.rs:277
   9: glutin_window::GlutinWindow::poll_event
             at /home/dietrich/.cargo/registry/src/github.com-1ecc6299db9ec823/pistoncore-glutin_window-0.63.0/src/lib.rs:204
  10: <glutin_window::GlutinWindow as window::Window>::poll_event
             at /home/dietrich/.cargo/registry/src/github.com-1ecc6299db9ec823/pistoncore-glutin_window-0.63.0/src/lib.rs:449
  11: event_loop::Events::next
             at /home/dietrich/.cargo/registry/src/github.com-1ecc6299db9ec823/pistoncore-event_loop-0.49.0/src/lib.rs:318
  12: piston_window::PistonWindow<W>::next
             at /home/dietrich/.cargo/registry/src/github.com-1ecc6299db9ec823/piston_window-0.105.0/src/lib.rs:310
  13: turtle::renderer::Renderer::run
             at /home/dietrich/.cargo/registry/src/github.com-1ecc6299db9ec823/turtle-1.0.0-rc.3/src/renderer.rs:90
  14: turtle::server::main
             at /home/dietrich/.cargo/registry/src/github.com-1ecc6299db9ec823/turtle-1.0.0-rc.3/src/server.rs:90
  15: turtle::server::start
             at /home/dietrich/.cargo/registry/src/github.com-1ecc6299db9ec823/turtle-1.0.0-rc.3/src/server.rs:66
  16: turtle::turtle_window::TurtleWindow::new
             at /home/dietrich/.cargo/registry/src/github.com-1ecc6299db9ec823/turtle-1.0.0-rc.3/src/turtle_window.rs:23
  17: turtle::turtle::Turtle::new
             at /home/dietrich/.cargo/registry/src/github.com-1ecc6299db9ec823/turtle-1.0.0-rc.3/src/turtle.rs:86
  18: rust_turtle::main
             at ./src/main.rs:4
  19: core::ops::function::FnOnce::call_once
             at /home/dietrich/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
enaut commented 3 years ago

Actually this seems to be fixed in git.

sunjay commented 3 years ago

Hi @enaut. Thanks for reporting this issue. See this comment for more details: https://github.com/sunjay/turtle/issues/202#issuecomment-695811144