rnote icon indicating copy to clipboard operation
rnote copied to clipboard

Crashing when pressing pen button with context menu open

Open 1over137 opened this issue 9 months ago • 4 comments

Describe the bug
Rnote crashes when pressing pen button with context menu open

To Reproduce
Steps to reproduce the behavior:

  1. Open context menu by using long-pressing on touchscreen on canvas
  2. Without letting the pen touch the screen, press button 1 on the pen (mapped to eraser, but a previous issue #1250 seems to suggest it may be treated as a separate pen). If it doesn't crash, pressing it a few more time guarantees it crashes

Expected behavior
Not crashing

Console Output
Note that there is no output between pressing the button and crashing, so I presume there's no useful info here.

(rnote:399767): Gtk-WARNING **: 15:14:33.593: Theme parser error: gtk.css:5506:3-9: No property named "filder"

(rnote:399767): Gtk-WARNING **: 15:14:33.593: Theme parser error: gtk.css:5524:3-9: No property named "filder"

(rnote:399767): Gtk-WARNING **: 15:14:33.594: Theme parser error: gtk.css:6733:16-17: Expected a number

(rnote:399767): Gtk-WARNING **: 15:14:33.594: Theme parser error: gtk.css:6917:22-27: Junk at end of value for outline-width

(rnote:399767): Gtk-WARNING **: 15:14:33.608: Theme parser error: gtk.css:5506:3-9: No property named "filder"

(rnote:399767): Gtk-WARNING **: 15:14:33.608: Theme parser error: gtk.css:5524:3-9: No property named "filder"

(rnote:399767): Gtk-WARNING **: 15:14:33.609: Theme parser error: gtk.css:6733:16-17: Expected a number

(rnote:399767): Gtk-WARNING **: 15:14:33.609: Theme parser error: gtk.css:6917:22-27: Junk at end of value for outline-width

(rnote:399767): Gtk-WARNING **: 15:14:34.267: GtkImage 0x5aaccc8b4cb0 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(rnote:399767): Gtk-WARNING **: 15:14:34.267: GtkImage 0x5aaccc6b6da0 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(rnote:399767): Gtk-WARNING **: 15:14:34.269: GtkImage 0x5aaccc60d0e0 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(rnote:399767): Gtk-WARNING **: 15:14:34.269: GtkImage 0x5aaccc60d8d0 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(rnote:399767): Gtk-WARNING **: 15:14:34.270: GtkImage 0x5aaccc068ed0 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(rnote:399767): Gtk-WARNING **: 15:14:34.270: GtkImage 0x5aaccc069730 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(rnote:399767): Gtk-WARNING **: 15:14:34.272: GtkImage 0x5aaccc0736b0 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(rnote:399767): Gtk-WARNING **: 15:14:34.272: GtkImage 0x5aaccc073e50 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(rnote:399767): Gtk-WARNING **: 15:14:34.273: GtkImage 0x5aaccc089150 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(rnote:399767): Gtk-WARNING **: 15:14:34.273: GtkImage 0x5aaccc0898f0 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(rnote:399767): Gtk-WARNING **: 15:14:34.293: GtkGizmo 0x5aaccc8b9230 (slider) reported min width -1, but sizes must be >= 0

(rnote:399767): Gtk-WARNING **: 15:14:34.293: GtkGizmo 0x5aaccc8b67f0 (slider) reported min height -1, but sizes must be >= 0

(rnote:399767): Gtk-WARNING **: 15:14:34.294: GtkGizmo 0x5aaccc88cdd0 (slider) reported min width -1, but sizes must be >= 0

(rnote:399767): Gtk-WARNING **: 15:14:34.294: GtkGizmo 0x5aaccc88a340 (slider) reported min height -1, but sizes must be >= 0

(rnote:399767): Gtk-WARNING **: 15:14:50.287: GtkGizmo 0x5aacccbf9290 (slider) reported min height -2, but sizes must be >= 0

(rnote:399767): Gtk-WARNING **: 15:14:50.303: GtkGizmo 0x5aacccbf9290 (slider) reported min height -1, but sizes must be >= 0

(rnote:399767): Gtk-WARNING **: 15:14:50.304: GtkGizmo 0x5aacccbf9290 (slider) reported min height -1, but sizes must be >= 0

(rnote:399767): Gtk-WARNING **: 15:14:50.320: GtkGizmo 0x5aacccbf9290 (slider) reported min height -1, but sizes must be >= 0

(rnote:399767): Gtk-WARNING **: 15:14:50.321: GtkGizmo 0x5aacccbf9290 (slider) reported min height -1, but sizes must be >= 0

(rnote:399767): Gtk-WARNING **: 15:14:50.337: GtkGizmo 0x5aacccbf9290 (slider) reported min height -1, but sizes must be >= 0

(rnote:399767): Gtk-WARNING **: 15:14:50.353: GtkGizmo 0x5aacccbf9290 (slider) reported min height -1, but sizes must be >= 0

(rnote:399767): Gtk-WARNING **: 15:14:50.354: GtkGizmo 0x5aacccbf9290 (slider) reported min height -1, but sizes must be >= 0

(rnote:399767): Gtk-WARNING **: 15:14:50.371: GtkGizmo 0x5aacccbf9290 (slider) reported min height -1, but sizes must be >= 0

(rnote:399767): Gtk-WARNING **: 15:14:50.387: GtkGizmo 0x5aacccbf9290 (slider) reported min height -1, but sizes must be >= 0
[1]    399767 segmentation fault (core dumped)  RUST_BACKTRACE=1 rnote test.rnote

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Arch Linux
  • App Version: Rnote v0.11.0
  • Installation Source: Arch repo
  • Desktop Environment: GNOME
  • Display Server: Wayland
  • Input Source: Thinkpad X1 yoga 6, AES pen

Additional context
Add any other context about the problem here.

1over137 avatar Mar 17 '25 19:03 1over137

What is your gtk4 version ?

If the rust backtrace doesn't return anything, chances are the issue is on gtk's side. What would be great would be to run

gdb rnote

then type bt when the segfault occurs and paste the result here

Doublonmousse avatar Mar 17 '25 20:03 Doublonmousse

What is your gtk4 version ?

gtk4 1:4.16.12-1

As a sidenote I've had this issue for a long time but only today I was able to reproduce it reliably. This does sound like a bug on the gtk side though.

gdb backtrace

Thread 1 "rnote" received signal SIGSEGV, Segmentation fault.
Downloading 92.86 K source file /usr/src/debug/gtk4/build/../gtk/gdk/gdksurface.c
gdk_surface_handle_event.isra.0 (event=event@entry=0x55555bce7030) at ../gtk/gdk/gdksurface.c:3081
3081        surface->request_motion = FALSE;
(gdb) bt
#0  gdk_surface_handle_event.isra.0 (event=event@entry=0x55555bce7030) at ../gtk/gdk/gdksurface.c:3081
#1  0x00007ffff709fd5c in _gdk_event_emit (event=0x55555bce7030) at ../gtk/gdk/gdkevents.c:491
#2  _gdk_event_queue_flush (display=0x5555565c2e00) at ../gtk/gdk/gdkevents.c:855
#3  gdk_surface_flush_events (clock=0x555556d58e40, data=0x555557f77020)
    at ../gtk/gdk/gdksurface.c:2509
#4  0x00007ffff7f44812 in g_closure_invoke (closure=0x5555567e9bc0, return_value=0x0,
    n_param_values=1, param_values=0x7fffffffb070, invocation_hint=0x7fffffffafc0)
    at ../glib/gobject/gclosure.c:833
#5  0x00007ffff7f74f85 in signal_emit_unlocked_R.isra.0 (node=node@entry=0x7fffffffb160,
    detail=detail@entry=0, instance=instance@entry=0x555556d58e40,
    emission_return=emission_return@entry=0x0,
    instance_and_params=instance_and_params@entry=0x7fffffffb070) at ../glib/gobject/gsignal.c:3902
#6  0x00007ffff7f65ce9 in signal_emit_valist_unlocked (instance=instance@entry=0x555556d58e40,
    signal_id=signal_id@entry=266, detail=detail@entry=0, var_args=var_args@entry=0x7fffffffb2d0)
    at ../glib/gobject/gsignal.c:3534
#7  0x00007ffff7f65f72 in g_signal_emit_valist (instance=0x555556d58e40, signal_id=266, detail=0,
    var_args=var_args@entry=0x7fffffffb2d0) at ../glib/gobject/gsignal.c:3277
#8  0x00007ffff7f66034 in g_signal_emit (instance=instance@entry=0x555556d58e40,
    signal_id=<optimized out>, detail=detail@entry=0) at ../glib/gobject/gsignal.c:3597
#9  0x00007ffff707f226 in _gdk_frame_clock_emit_flush_events (frame_clock=0x555556d58e40)
    at ../gtk/gdk/gdkframeclock.c:696
#10 gdk_frame_clock_flush_idle (data=0x555556d58e40) at ../gtk/gdk/gdkframeclockidle.c:391
#11 0x00007ffff7e3a58a in g_timeout_dispatch (source=source@entry=0x55555bcec5e0,
    callback=<optimized out>, user_data=<optimized out>) at ../glib/glib/gmain.c:5111
--Type <RET> for more, q to quit, c to continue without paging--c
#12 0x00007ffff7e39104 in g_main_dispatch (context=0x55555659d760) at ../glib/glib/gmain.c:3398
#13 0x00007ffff7e9cd57 in g_main_context_dispatch_unlocked (context=0x55555659d760)
    at ../glib/glib/gmain.c:4249
#14 g_main_context_iterate_unlocked.isra.0 (context=context@entry=0x55555659d760, block=block@entry=1,
    dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/glib/gmain.c:4314
#15 0x00007ffff7e38535 in g_main_context_iteration (context=context@entry=0x55555659d760,
    may_block=may_block@entry=1) at ../glib/glib/gmain.c:4379
#16 0x00007ffff7b34756 in g_application_run (application=0x555556597720, argc=<optimized out>,
    argv=<optimized out>) at ../glib/gio/gapplication.c:2715
#17 0x0000555555875d94 in gio::application::ApplicationExtManual::run_with_args<rnote::app::RnApp, alloc::string::String> (args=..., self=<optimized out>)
    at /usr/src/debug/rnote/build/cargo-home/registry/src/index.crates.io-6f17d22bba15001f/gio-0.19.8/src/application.rs:29
#18 gio::application::ApplicationExtManual::run<rnote::app::RnApp> (self=<optimized out>)
    at /usr/src/debug/rnote/build/cargo-home/registry/src/index.crates.io-6f17d22bba15001f/gio-0.19.8/src/application.rs:22
#19 rnote::main () at crates/rnote-ui/src/main.rs:85

1over137 avatar Mar 17 '25 20:03 1over137

Yes this is a gtk issue, please open an issue upstream on https://gitlab.gnome.org/GNOME/gtk/-/issues

Looking at the line in question, https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gdk/gdksurface.c?ref_type=heads#L3098, I wonder if the surface is somehow NULL for the event https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gdk/gdksurface.c?ref_type=heads#L3089 when calling gdk_event_get_surface

Doublonmousse avatar Mar 17 '25 20:03 Doublonmousse

Thanks, filed upstream bug. Upon further testing this happens with any GTK3/4 app, not just rnote.

https://gitlab.gnome.org/GNOME/gtk/-/issues/7416

1over137 avatar Mar 17 '25 21:03 1over137