Skip to content

Ignore unrecognized keyboard modifiers #575

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

Merged
merged 1 commit into from
Dec 21, 2016

Conversation

Thinkofname
Copy link
Contributor

Fixes a crash when pressing any key on linux.

Not completely sure why linux has something extra here (doesn't seem visible in sdl2's source) but I wasn't the only one with this issue.

Fixes a crash when pressing any key on linux
@Cobrand
Copy link
Member

Cobrand commented Dec 21, 2016

Weird, I am on linux and everything works fine on my machine. I will merge this, but would you mind giving me the full details of how you discovered this, why do you think this happens and stuff like that ?

This crash might have been raised when I refactored every #[repr(isize)] structs into #[repr(i32)] internally (I don't see anything else), but if this is the case, there might be other issues as well as this one, and giving me hindsight as of why this crash happens will help me.

@Cobrand Cobrand merged commit 9604e85 into Rust-SDL2:master Dec 21, 2016
@Thinkofname
Copy link
Contributor Author

Thinkofname commented Dec 21, 2016

Happened when I updated from 0.20.1 to 0.27.0 (sorry for the wide range) after a friend who was on 0.26-0.27 was having a crash on keypress (stack trace below). I ended up getting the same crash in events.poll_iter()

   1:     0x55da113daeca - std::sys::imp::backtrace::tracing::imp::write::h0d1aacfb8fc693ac
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:42
   2:     0x55da113dd41f - std::panicking::default_hook::{{closure}}::hff87359baf5754d0
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panicking.rs:349
   3:     0x55da113dd01e - std::panicking::default_hook::h936f17ca3b2b98dc
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panicking.rs:365
   4:     0x55da113dd807 - std::panicking::rust_panic_with_hook::he9c830ab830c7944
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panicking.rs:553
   5:     0x55da113dd694 - std::panicking::begin_panic::hbd10b7f500042f98
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panicking.rs:515
   6:     0x55da113dd5b9 - std::panicking::begin_panic_fmt::h49583ddd44614a0d
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panicking.rs:499
   7:     0x55da113dd547 - rust_begin_unwind
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panicking.rs:475
   8:     0x55da11407d2d - core::panicking::panic_fmt::h3b787d0ceafd7204
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libcore/panicking.rs:69
   9:     0x55da11407c64 - core::panicking::panic::h57808c0fa90ee3ee
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libcore/panicking.rs:49
  10:     0x55da113c8f64 - <core::option::Option<T>>::unwrap::h1e75948f13073bd9
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libcore/macros.rs:21
  11:     0x55da113d02bf - sdl2::event::Event::from_ll::h519b53b64a834c6d
                        at /home/brandon/.cargo/registry/src/github.com-1ecc6299db9ec823/sdl2-0.26.0/src/sdl2/event.rs:1307
  12:     0x55da113d15fd - sdl2::event::poll_event::h877b909c47333539
                        at /home/brandon/.cargo/registry/src/github.com-1ecc6299db9ec823/sdl2-0.26.0/src/sdl2/event.rs:1682
  13:     0x55da113d1697 - <sdl2::event::EventPollIterator<'a> as core::iter::iterator::Iterator>::next::hf7b66676583b13a3
                        at /home/brandon/.cargo/registry/src/github.com-1ecc6299db9ec823/sdl2-0.26.0/src/sdl2/event.rs:1813
  14:     0x55da113beddb - game::main::hbadf542e04a83a57
                        at /home/brandon/Desktop/game/game/src/main.rs:74
  15:     0x55da113e469a - __rust_maybe_catch_panic
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libpanic_unwind/lib.rs:98
  16:     0x55da113ddf46 - std::rt::lang_start::ha749a62502c90792
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panicking.rs:434
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panic.rs:351
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/rt.rs:57
  17:     0x55da113c76e2 - main
  18:     0x7f517772482f - __libc_start_main
  19:     0x55da113755f8 - _start
  20:                0x0 - <unknown>

Both of us are on ubuntu x64 if it makes a difference.

Edit: Happens on the examples cargo run --example=animation too

@Cobrand
Copy link
Member

Cobrand commented Dec 21, 2016

Thanks for the stack trace, I will dig into this. The patch is up on crates.io as 0.27.1 for you and your friend

@Thinkofname
Copy link
Contributor Author

Thanks. I should add we are both running nightly of rustc

@Cobrand
Copy link
Member

Cobrand commented Dec 21, 2016

Even with cargo run --example animation, nothing. This must not be linked to the architecture, but maybe bitflags itself or something ?

cobrand ~/C/R/rust-sdl2 ((v0.27)) cargo run --example animation
   Compiling sdl2 v0.27.0 (file:///home/cobrand/Code/Rust/rust-sdl2)
    Finished debug [unoptimized + debuginfo] target(s) in 5.11 secs
     Running `target/debug/examples/animation`
cobrand ~/C/R/rust-sdl2 ((v0.27))

@Thinkofname
Copy link
Contributor Author

I just tried stable rustc and couldn't reproduce the issue but can with nightly every time after a single press. This might actually be a rustc bug?
Versions i'm testing with

rustc +nightly --version
rustc 1.15.0-nightly (71c06a56a 2016-12-18)

rustc +stable --version
rustc 1.13.0 (2c6933acc 2016-11-07)

@Thinkofname
Copy link
Contributor Author

Finally tracked down the actual issue and filed #579

@Cobrand Cobrand mentioned this pull request Dec 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants