Skip to content
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

[super_context_menu] Crash on Linux when right-clicking quickly #403

Closed
Merrit opened this issue Jul 31, 2024 · 2 comments · Fixed by #394
Closed

[super_context_menu] Crash on Linux when right-clicking quickly #403

Merrit opened this issue Jul 31, 2024 · 2 comments · Fixed by #394

Comments

@Merrit
Copy link

Merrit commented Jul 31, 2024

When right-clicking on a ContextMenuWidget in quick succession, the Flutter app crashes.

Minimal Repro

import 'package:flutter/material.dart';
import 'package:super_context_menu/super_context_menu.dart';

void main() {
  runApp(const MainApp());
}

class MainApp extends StatelessWidget {
  const MainApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: ContextMenuWidget(
            menuProvider: (_) {
              return Menu(
                children: [
                  MenuAction(
                    title: 'Hi!',
                    callback: () => print('Hi!'),
                  ),
                ],
              );
            },
            child: ElevatedButton(
              child: const Text('Hello World!'),
              onPressed: () => print('Hello World!'),
            ),
          ),
        ),
      ),
    );
  }
}

Right-click the button several times in succession while moving the cursor slightly around the button's area.

Crashes with Invalid event type.

Backtrace
❯ env RUST_BACKTRACE=full flutter run -d linux
Launching lib/main.dart on Linux in debug mode...
Building Linux application...                                           
✓ Built build/linux/x64/debug/bundle/context_menu_crash
Syncing files to device Linux...                                    82ms

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

A Dart VM Service on Linux is available at: http://127.0.0.1:41727/wy_Qw_xUqdk=/
The Flutter DevTools debugger and profiler on Linux is available at: http://127.0.0.1:9103?uri=http://127.0.0.1:41727/wy_Qw_xUqdk=/
thread '<unnamed>' panicked at src/./linux/common.rs:105:9:
Invalid event type
stack backtrace:
   0:     0x7fd6b20fea65 - std::backtrace_rs::backtrace::libunwind::trace::h58eed11393533053
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x7fd6b20fea65 - std::backtrace_rs::backtrace::trace_unsynchronized::h6af9bae28ebb6388
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fd6b20fea65 - std::sys_common::backtrace::_print_fmt::hb6748916642a4fb2
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7fd6b20fea65 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h3692694645b1bb6a
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fd6b21218ab - core::fmt::rt::Argument::fmt::h7aa93977ba74ae0f
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/core/src/fmt/rt.rs:165:63
   5:     0x7fd6b21218ab - core::fmt::write::h5131d80b4c69b88d
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/core/src/fmt/mod.rs:1168:21
   6:     0x7fd6b20fc9bf - std::io::Write::write_fmt::h1fb327a7d8b0eb36
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/io/mod.rs:1835:15
   7:     0x7fd6b20fe83e - std::sys_common::backtrace::_print::he6ebb7b9d89f4456
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7fd6b20fe83e - std::sys_common::backtrace::print::h998d75b840f75a73
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7fd6b20ffaf9 - std::panicking::default_hook::{{closure}}::h18ec7fe6a38b9da0
  10:     0x7fd6b20ff89a - std::panicking::default_hook::hfb3f22c2e4075a6a
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/panicking.rs:298:9
  11:     0x7fd6b20fff93 - std::panicking::rust_panic_with_hook::h51af00bcb4660c4e
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/panicking.rs:795:13
  12:     0x7fd6b20ffe3b - std::panicking::begin_panic_handler::{{closure}}::h39f76aa863fbe8ce
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/panicking.rs:656:13
  13:     0x7fd6b20fef29 - std::sys_common::backtrace::__rust_end_short_backtrace::h4d10fc2251b89840
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/sys_common/backtrace.rs:171:18
  14:     0x7fd6b20ffba7 - rust_begin_unwind
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/panicking.rs:652:5
  15:     0x7fd6b1e43f33 - core::panicking::panic_fmt::h319840fcbcd912ef
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/core/src/panicking.rs:72:14
  16:     0x7fd6b1e7b203 - super_native_extensions::platform_impl::platform::common::synthesize_button_up::h705e74c58ddce1d3
                               at /home/merritt/.pub-cache/hosted/pub.dev/super_native_extensions-0.8.18/rust/src/./linux/common.rs:105:9
  17:     0x7fd6b1e94bf7 - super_native_extensions::platform_impl::platform::menu::PlatformMenuContext::show_context_menu::{{closure}}::hbceb5077530f31ff
                               at /home/merritt/.pub-cache/hosted/pub.dev/super_native_extensions-0.8.18/rust/src/./linux/menu.rs:399:27
  18:     0x7fd6b1e4cc4d - super_native_extensions::menu_manager::MenuManager::show_context_menu::{{closure}}::heea789cc9c5e354e
                               at /home/merritt/.pub-cache/hosted/pub.dev/super_native_extensions-0.8.18/rust/src/menu_manager.rs:183:49
  19:     0x7fd6b1e4f4d5 - <super_native_extensions::menu_manager::MenuManager as irondash_message_channel::async_method_handler::AsyncMethodHandler>::on_method_call::{{closure}}::h5ee14f049b352991
                               at /home/merritt/.pub-cache/hosted/pub.dev/super_native_extensions-0.8.18/rust/src/menu_manager.rs:365:22
  20:     0x7fd6b1fa01af - <core::pin::Pin<P> as core::future::future::Future>::poll::h7fdfb663f3b2a6a6
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/core/src/future/future.rs:123:9
  21:     0x7fd6b1f5b435 - <irondash_message_channel::async_method_handler::RegisteredAsyncMethodHandlerInner<T> as irondash_message_channel::message_channel::MessageChannelDelegate>::on_message::{{closure}}::h1da545207a76a0a7
                               at /home/merritt/.cargo/registry/src/index.crates.io-6f17d22bba15001f/irondash_message_channel-0.7.0/src/async_method_handler.rs:211:59
  22:     0x7fd6b1e63370 - irondash_run_loop::task::Task<T>::poll::hafebc6df6abd6af9
                               at /home/merritt/.cargo/registry/src/index.crates.io-6f17d22bba15001f/irondash_run_loop-0.5.0/src/task.rs:48:13
  23:     0x7fd6b1e635eb - <irondash_run_loop::task::Task<T> as futures_task::arc_wake::ArcWake>::wake_by_ref::{{closure}}::h69b2e7ff1ec8282f
                               at /home/merritt/.cargo/registry/src/index.crates.io-6f17d22bba15001f/irondash_run_loop-0.5.0/src/task.rs:59:45
  24:     0x7fd6b1e497d5 - irondash_run_loop::platform::platform_impl::PlatformRunLoop::schedule::{{closure}}::h257d34192a70da1a
                               at /home/merritt/.cargo/registry/src/index.crates.io-6f17d22bba15001f/irondash_run_loop-0.5.0/src/platform/linux/mod.rs:177:13
  25:     0x7fd6b1e4a46b - irondash_run_loop::platform::platform_impl::context_add_source::trampoline::hef283ca0f9d5956c
                               at /home/merritt/.cargo/registry/src/index.crates.io-6f17d22bba15001f/irondash_run_loop-0.5.0/src/platform/linux/mod.rs:35:9
  26:     0x7fd6b2a5e0d9 - <unknown>
  27:     0x7fd6b2a57e8c - <unknown>
  28:     0x7fd6b2ab9c98 - <unknown>
  29:     0x7fd6b2a59383 - g_main_context_iteration
  30:     0x7fd6b2c2b0fd - g_application_run
  31:           0x402481 - main
                               at /home/merritt/Downloads/context_menu_crash/linux/main.cc:5:10
  32:     0x7fd6b2439088 - __libc_start_call_main
  33:     0x7fd6b243914b - __libc_start_main_impl
  34:           0x402365 - _start
  35:                0x0 - <unknown>
fatal runtime error: failed to initiate panic, error 5
Lost connection to device.

System Info

Operating System: Fedora Linux 40
KDE Plasma Version: 6.1.3
KDE Frameworks Version: 6.4.0
Qt Version: 6.7.2
Kernel Version: 6.9.11-200.fc40.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 3700X 8-Core Processor
Memory: 31.3 GiB of RAM
Graphics Processor: AMD Radeon RX 580 Series
Manufacturer: Micro-Star International Co., Ltd.
Product Name: MS-7C56
System Version: 6.0
flutter doctor
❯ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.22.3, on Fedora Linux 40 (KDE Plasma) 6.9.11-200.fc40.x86_64, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2024.1)
[✓] VS Code (version 1.91.1)
[✓] VS Code (version 1.92.0-insider)
[✓] Connected device (2 available)
[✓] Network resources

• No issues found!
@knopp
Copy link
Collaborator

knopp commented Jul 31, 2024

I think this might be fixed by #394. I'm trying to get to it.

@Merrit
Copy link
Author

Merrit commented Jul 31, 2024

Ah, you're already on top of it. Thank you! 💙

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 a pull request may close this issue.

2 participants