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

Crash in input-method-v1 when restarting fcitx5 #2260

Closed
lilydjwg opened this issue Mar 25, 2024 · 3 comments · Fixed by #2261
Closed

Crash in input-method-v1 when restarting fcitx5 #2260

lilydjwg opened this issue Mar 25, 2024 · 3 comments · Fixed by #2261
Labels

Comments

@lilydjwg
Copy link
Contributor

Describe the bug

To Reproduce
Steps to reproduce the behavior:

  1. Enable plugin input-method-v1
  2. In a terminal run fcitx5 -r to restart it
  3. Wayfire crashes

Expected behavior
No crash.

Screenshots or stacktrace

#0  0x00007f4bbea4f4c5 in wayfire_input_method_v1_context::deactivate (this=0x590eed017c50, im_killed=<optimized out>)
    at ../../../../../../../build/wayfire/plugins/protocols/input-method-v1.cpp:119
#1  0x00007f4bbea54fc1 in wayfire_input_method_v1::reset_current_im_context (this=this@entry=0x590eec9a91b0, im_killed=im_killed@entry=true) at /usr/include/c++/13.2.1/bits/unique_ptr.h:199
#2  0x00007f4bbea5530a in wayfire_input_method_v1::handle_destroy_im (resource=<optimized out>) at ../../../../../../../build/wayfire/plugins/protocols/input-method-v1.cpp:713
#3  0x00007f4bd5d299ba in destroy_resource (element=0x590eeccb33c0, data=data@entry=0x7ffdb7ca2df4, flags=0) at ../wayland-1.22.0/src/wayland-server.c:732
#4  0x00007f4bd5d2a0db in for_each_helper (entries=0x590eec9bb840, data=0x7ffdb7ca2df4, func=0x7f4bd5d29900 <destroy_resource>) at ../wayland-1.22.0/src/wayland-util.c:416
#5  wl_map_for_each (data=0x7ffdb7ca2df4, func=0x7f4bd5d29900 <destroy_resource>, map=0x590eec9bb840) at ../wayland-1.22.0/src/wayland-util.c:430
#6  wl_client_destroy (client=client@entry=0x590eec9bb810) at ../wayland-1.22.0/src/wayland-server.c:928
#7  0x00007f4bd5d2a60e in destroy_client_with_error (reason=<optimized out>, client=<optimized out>) at ../wayland-1.22.0/src/wayland-server.c:325
#8  wl_client_connection_data (fd=<optimized out>, mask=<optimized out>, data=<optimized out>) at ../wayland-1.22.0/src/wayland-server.c:454
#9  0x00007f4bd5d29ae2 in wl_event_loop_dispatch (loop=0x590eebab8e10, timeout=timeout@entry=-1) at ../wayland-1.22.0/src/event-loop.c:1027
#10 0x00007f4bd5d2a2d7 in wl_display_run (display=0x590eebab8d20) at ../wayland-1.22.0/src/wayland-server.c:1493
#11 0x0000590eeb617d49 in main (argc=<optimized out>, argv=<optimized out>) at ../../../../../../../build/wayfire/src/main.cpp:476
(gdb) p this->text_input 
$1 = (wlr_text_input_v3 *) 0x0

Guarding with a null check will leave Enter pressed and repeating in the terminal.

Wayfire version
git. I don't know why it didn't happen in the past when I tested this.

@lilydjwg lilydjwg added the bug label Mar 25, 2024
@ammen99
Copy link
Member

ammen99 commented Mar 25, 2024

Oh, this is a stupid bug. text_input is reset on line 99, but then used on line 119. Can you try moving it around to see whether the bug is resovled?

@ammen99
Copy link
Member

ammen99 commented Mar 25, 2024

Also I'd expect it would be hard to trigger the bug reliably (for ex. in a test) because it depends on a particular race condition, as the comment on line 115-116 explains.

@lilydjwg
Copy link
Contributor Author

Can you try moving it around to see whether the bug is resovled?

Yes, this bug seems to be resolved, but it crashed elsewhere once (corrupted double-linked list in surface_apply_damage -> wlr_client_buffer_create; I'll file a new bug for it if I can reproduce).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants