swaywm / wlroots

A modular Wayland compositor library
https://gitlab.freedesktop.org/wlroots/wlroots/
MIT License
2.15k stars 342 forks source link

examples/input-method: crash in do_updates #2790

Open mozartilize opened 3 years ago

mozartilize commented 3 years ago

wlroots has migrated to gitlab.freedesktop.org. This issue has been moved to:

https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/2790

emersion commented 3 years ago

Please provide more details, like a stack trace.

mozartilize commented 3 years ago

hi, I'm learning to write a input method and this is best I can do

❯ gdb build/examples/input-method
GNU gdb (GDB) 10.1
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from build/examples/input-method...
(gdb) run
Starting program: [...]/wlroots/build/examples/input-method 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Timer armed
Handle serial 1
Now active
content_type.purpose: TERMINAL
Update 0
Timer armed
Handle serial 2
Update 1
_Commit_Handle serial 3
Update 2

Program received signal SIGSEGV, Segmentation fault.
0x00005555555578b3 in do_updates () at ../examples/input-method.c:197
197         if (strcmp(current.surrounding.text, "_Commit_") != 0) {
(gdb) n

Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.
(gdb) q
emersion commented 3 years ago

Can you try "bt full"?

mozartilize commented 3 years ago
(gdb) bt full
#0  0x00005555555578b3 in do_updates () at ../examples/input-method.c:197
No locals.
#1  0x0000555555557bd5 in handle_done (data=0x0, zwp_input_method_v2=0x555555563c40) at ../examples/input-method.c:275
        prev_active = true
        default_state = {change_cause = ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_INPUT_METHOD, content_type = {hint = ZWP_TEXT_INPUT_V3_CONTENT_HINT_NONE, purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_NORMAL}, surrounding = {
            text = 0x0, cursor = 0, anchor = 0}}
#2  0x00007ffff7db4acd in ?? () from /usr/lib/libffi.so.7
No symbol table info available.
#3  0x00007ffff7db403a in ?? () from /usr/lib/libffi.so.7
No symbol table info available.
#4  0x00007ffff7f90fe4 in ?? () from /usr/lib/libwayland-client.so.0
No symbol table info available.
#5  0x00007ffff7f8d563 in ?? () from /usr/lib/libwayland-client.so.0
No symbol table info available.
#6  0x00007ffff7f8ecac in wl_display_dispatch_queue_pending () from /usr/lib/libwayland-client.so.0
No symbol table info available.
#7  0x00005555555580de in main (argc=<optimized out>, argv=<optimized out>) at ../examples/input-method.c:388
        registry = <optimized out>
        display_fd = 3
        epoll = 5
        epoll_display = {events = 5, data = {ptr = 0x3, fd = 3, u32 = 3, u64 = 3}}
        epoll_timer = {events = 1, data = {ptr = 0x4, fd = 4, u32 = 4, u64 = 4}}
        caught = {events = 4, data = {ptr = 0x3, fd = 3, u32 = 3, u64 = 3}}
        __PRETTY_FUNCTION__ = "main"