4JX / L5P-Keyboard-RGB

Cross platform software to control the RGB/lighting of the 4 zone keyboard included in the 2020, 2021, 2022 and 2023 lineup of the Lenovo Legion laptops. Works on Windows and Linux.
GNU General Public License v3.0
308 stars 39 forks source link

Crash when inputting numbers in boxes in GUI mode #81

Closed ZechariahB closed 1 year ago

ZechariahB commented 2 years ago

When inputting numbers into the boxes, this application often crashes in GUI mode. These boxes can also be resized left or right, which is definitely not supposed to happen. Here is the crash log.

No subcommands found, starting in GUI mode. To view the possible subcommands type "legion-kb-rgb --help".
The application panicked (crashed).
Message:  called `Result::unwrap()` on an `Err` value: Unknown("An unknown error occurred!")
Location: src/gui/app.rs:102

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                                ⋮ 8 frames hidden ⋮                               
   9: legion_kb_rgb::gui::app::App::start_ui::h850c2f7f08740869
      at <unknown source file>:<unknown line>
  10: legion_kb_rgb::cli::try_cli::h269fff4a84552eb4
      at <unknown source file>:<unknown line>
  11: legion_kb_rgb::main::h4795929818dda366
      at <unknown source file>:<unknown line>
  12: std::sys_common::backtrace::__rust_begin_short_backtrace::he9e2516d859af302
      at <unknown source file>:<unknown line>
  13: std::rt::lang_start::{{closure}}::h218a02376d1f626e
      at <unknown source file>:<unknown line>
  14: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h5f1ba3b861cac230
      at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/ops/function.rs:280
  15: std::panicking::try::do_call::h4febfdb770eca39d
      at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:492
  16: std::panicking::try::h8b0eac8a7d726dbf
      at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:456
  17: std::panic::catch_unwind::h11b83c489c0d8394
      at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panic.rs:137
  18: std::rt::lang_start_internal::{{closure}}::h63502d2988634103
      at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/rt.rs:128
  19: std::panicking::try::do_call::h4be475cff12d2aae
      at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:492
  20: std::panicking::try::h1a3b25b8eaf9ba31
      at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:456
  21: std::panic::catch_unwind::h224588ada67b9b0b
      at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panic.rs:137
  22: std::rt::lang_start_internal::h2807b375c1959759
      at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/rt.rs:128
  23: main<unknown>
      at <unknown source file>:<unknown line>
  24: __libc_start_call_main<unknown>
      at <unknown source file>:<unknown line>
  25: __libc_start_main_impl<unknown>
      at <unknown source file>:<unknown line>
  26: _start<unknown>
      at <unknown source file>:<unknown line>
4JX commented 1 year ago

The latter is a problem of the GUI toolkit I'm using. As for the crash what is your OS?

ZechariahB commented 1 year ago

OS: Fedora Linux 36 (Workstation Edition) GNOME Version: 42.4 Windowing System: X11

The crash has a chance of occurring when replacing the 0s with numbers. Using this program in command line has no crash.

4JX commented 1 year ago

I've been trying to reproduce this crash to no avail for a while now, mind trying to get it on video?

ZechariahB commented 1 year ago

I've been able to reproduce this by selecting numbers with the mouse and mashing in random numbers, then doing this over and over again to other boxes. It happens if you are unlucky enough it seems, but is pretty easy to activate.

2022-11-13 04-44-42.webm

rosszm commented 1 year ago

I have also been experiencing this crash.

Looks like its due to app::wait_for(0.2).unwrap() at lines 100 and 104 here: https://github.com/4JX/L5P-Keyboard-RGB/blob/5a6cc0f226613887a13687d441db5aac84aff8ba/src/gui/app.rs#L98-L112

FLTK wait_for() produces an FltkError::Unknown error on UNIX systems if a signal happens. This unhandled error appears to be what is causing the crash.

I have created a pull request with a fix: PR #97

4JX commented 1 year ago

Fixed via 0.19.0