bragefuglseth / keypunch

Practice your typing skills
GNU General Public License v3.0
85 stars 13 forks source link

[Bug]: backspace on gnome-mobile crashes app #15

Closed ashrude closed 1 month ago

ashrude commented 1 month ago

Describe the bug When using the application through flathub on my oneplus 6t running postmarketos with gnome-mobile, the application will crash when I press backspace

bragefuglseth commented 1 month ago

Thanks for reporting! Is it possible for you to obtain a crash log / stack trace? What text did you use, and what letter did you attempt to erase?

bragefuglseth commented 1 month ago

I'd also be happy to hear more about how the app works on mobile in general. I don't have a Linux phone to test it with myself currently.

ashrude commented 1 month ago

I'm new to gtk/rust development, how can I get a stack trace/crash log?

Other than the bug it actually works great on mobile. It's smooth, it displays everything properly and uses the libadwaita dialogues

bragefuglseth commented 1 month ago

Try opening the app with this command and checking the output when it crashes:

flatpak run --verbose dev.bragefuglseth.Keypunch
heldderarbeit commented 1 month ago

Seems to be specific for Gnome mobile. Running Phosh 0.33 on pmOS v23.12, backspace does not crash the app. I also don't spot any other bugs. Everything seems to work as expected.

heldderarbeit commented 1 month ago

I'd also be happy to hear more about how the app works on mobile in general. I don't have a Linux phone to test it with myself currently.

One thing that might be improved, after you start typing the top bar with the settings disappears. On desktop that's not too bad because you can press ESC, but on the setup I described here there is no easy access to that key on the default phosh keyboard, you have only numbers and letters and special characters but no control keys. If you set the timer to 10 minutes you can't access the settings for 10 minutes, unless of course killing the app.

20240608_23h40m15s_grim

HighKingofMelons commented 1 month ago

I am able to reproduce using GNOME's built in virtual keyboard on a desktop computer (Fedora Silverblue 40). I imagine the keyboard on gnome-mobile is the same as the one upstream.

Didn't manage to wrestle out any commandline output relevant to the app itself, but here's stacktrace.

#0  0x00007ffff6c106f0 in g_utf8_pointer_to_offset () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#1  0x00007ffff738a592 in text_input_delete_surrounding_text () at /usr/lib/x86_64-linux-gnu/libgtk-4.so.1
#2  0x00007ffff7c76056 in ffi_call_unix64 () at /usr/lib/x86_64-linux-gnu/libffi.so.8
#3  0x00007ffff7c74b4d in ffi_call_int () at /usr/lib/x86_64-linux-gnu/libffi.so.8
#4  0x00007ffff7c75303 in ffi_call () at /usr/lib/x86_64-linux-gnu/libffi.so.8
#5  0x00007ffff61f2ece in wl_closure_invoke.constprop () at /usr/lib/x86_64-linux-gnu/libwayland-client.so.0
#6  0x00007ffff61f3753 in dispatch_event.isra () at /usr/lib/x86_64-linux-gnu/libwayland-client.so.0
#7  0x00007ffff61f39fc in wl_display_dispatch_queue_pending () at /usr/lib/x86_64-linux-gnu/libwayland-client.so.0
#8  0x00007ffff7471d07 in _gdk_wayland_display_queue_events () at /usr/lib/x86_64-linux-gnu/libgtk-4.so.1
#9  0x00007ffff74bec67 in gdk_display_get_event () at /usr/lib/x86_64-linux-gnu/libgtk-4.so.1
#10 0x00007ffff7471976 in gdk_event_source_dispatch () at /usr/lib/x86_64-linux-gnu/libgtk-4.so.1
#11 0x00007ffff6bd4667 in g_main_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#12 0x00007ffff6bd6787 in g_main_context_iterate_unlocked.isra () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#13 0x00007ffff6bd6e43 in g_main_context_iteration () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#14 0x00007ffff6dbc05d in g_application_run () at /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#15 0x000055555571c43e in gio::application::ApplicationExtManual::run_with_args<keypunch::application::KpApplication, alloc::string::String> (self=0x7fffffffe058, args=...) at /var/home/melon/Projekter/.gnome-builder/projects/keypunch/builds/dev.bragefuglseth.Keypunch.Devel.json-flatpak-org.gnome.Platform-46-x86_64-main/cargo-home/registry/src/index.crates.io-6f17d22bba15001f/gio-0.19.5/src/application.rs:29
        argc = 1
        argv = alloc::vec::Vec<&str, alloc::alloc::Global> {buf: alloc::raw_vec::RawVec<&str, alloc::alloc::Global> {ptr: core::ptr::unique::Unique<&str> {pointer: core::ptr::non_null::NonNull<&str> {pointer: 0x555555af7ab0}, _marker: core::marker::PhantomData<&str>}, cap: alloc::raw_vec::Cap (1), alloc: alloc::alloc::Global}, len: 1}
#16 0x000055555571c559 in gio::application::ApplicationExtManual::run<keypunch::application::KpApplication> (self=0x7fffffffe058) at /var/home/melon/Projekter/.gnome-builder/projects/keypunch/builds/dev.bragefuglseth.Keypunch.Devel.json-flatpak-org.gnome.Platform-46-x86_64-main/cargo-home/registry/src/index.crates.io-6f17d22bba15001f/gio-0.19.5/src/application.rs:22
#17 0x0000555555714729 in keypunch::main () at src/main.rs:58
        app = keypunch::application::KpApplication {inner: glib::object::TypedObjectRef<keypunch::application::imp::KpApplication, libadwaita::auto::application::Application> {inner: glib::object::ObjectRef {inner: core::ptr::non_null::NonNull<gobject_sys::GObject> {pointer: 0x555555af7c00}}, imp: core::marker::PhantomData<keypunch::application::imp::KpApplication>, parent: core::marker::PhantomData<libadwaita::auto::application::Application>}, phantom: core::marker::PhantomData<()>}
bragefuglseth commented 1 month ago

When I try to reproduce the issue myself with the desktop OSK, nothing happens when I press backspace. Something is definitely wrong, but it doesn't crash the app for me.

bragefuglseth commented 1 month ago

Ok, from looking at the source code of the OSK's backspace key, I can infer that it uses the input method directly to delete text. This isn't something I've set Keypunch's input machinery up for, but I have a working implementation of it on my machine now, where text gets deleted as expected.

bragefuglseth commented 1 month ago

This commit fixes everything on my end. @ashrude, can you install the latest build artifact and confirm that it works on your end as well?

ashrude commented 1 month ago

Is there an arm version?

bragefuglseth commented 1 month ago

Ah, no, CI doesn’t produce that. You could build the app yourself in Builder, though, or export a Flatpak bundle. If you don’t know how to do that, I can try to export one for you tomorrow.

ashrude commented 1 month ago

Sorry I completely forgot I spent a couple hours yesterday getting builder set up on my phone.

It works perfectly, no crashing.

bragefuglseth commented 1 month ago

Great! Thanks again for reporting!