Segfault on terminate with seat input
I have noticed that if you are moving the mouse while exiting sway cleanly a segfault occurs. This is due to input_event still triggering while wlc is terminating.
[commands.c:2793] find_handler(exit) 0
[main.c:43] [wlc] Terminating wlc...
[main.c:43] [wlc] Terminating compositor...
[main.c:43] [wlc] Output (1) terminated...
[container.c:350] OUTPUT: Destroying output '1'
[main.c:43] [wlc] Removed bsurface from output (1)
[main.c:43] [wlc] Removed output (1)
[main.c:43] [wlc] Compositor terminated...
[log.c:150] Error: Signal 11. Printing backtrace
[log.c:160] Backtrace: sway(error_handler+0xb7) [0x4239ee]
[log.c:160] Backtrace: /usr/lib/libc.so.6(+0x33330) [0x7f8735958330]
[log.c:160] Backtrace: sway() [0x41917e]
[log.c:160] Backtrace: wlc/src/libwlc.so.0(+0x157b7) [0x7f8736ad77b7] seat.c:169
[log.c:160] Backtrace: wlc/src/libwlc.so.0(+0x1b6dd) [0x7f8736add6dd]
[log.c:160] Backtrace: wlc/src/libwlc.so.0(+0x1bf18) [0x7f8736addf18]
[log.c:160] Backtrace: /usr/lib/libwayland-server.so.0(wl_event_loop_dispatch+0xc8) [0x7f87361fe888]
[log.c:160] Backtrace: /usr/lib/libwayland-server.so.0(wl_display_run+0x25) [0x7f87361fcee5]
[log.c:160] Backtrace: wlc/src/libwlc.so.0(wlc_run+0xc3) [0x7f8736aea967]
[log.c:160] Backtrace: sway(main+0x49f) [0x42050b]
[log.c:160] Backtrace: /usr/lib/libc.so.6(__libc_start_main+0xf0) [0x7f8735945710]
[log.c:160] Backtrace: sway(_start+0x29) [0x406b99]
I can think of 2 ways to fix this issue.
- Check for compositor->state.terminating inside input_event
- Have a terminating listener inside seat
I have tried the first option and it works. Would you prefer a terminate listener or do you have a better way?
What if you move wlc_input_terminate before wlc_compositor_release in wlc.c @ wlc_cleanup? Does this happen under X11 backend?
Moving wlc_input_terminate does not help. Yes it is under the X11 backend
What is exact trace for this? As that track is missing important symbols. If this is under X11 the proper fix is to have the terminating order corrected in compositor.c.
[log.c:150] Error: Signal 11. Printing backtrace
[log.c:160] Backtrace: sway(error_handler+0xb7) [0x4239ee]
[log.c:160] Backtrace: /usr/lib/libc.so.6(+0x33330) [0x7f70f2db0330]
[log.c:160] Backtrace: sway() [0x41917e] sway/sway/handlers.c:534
[log.c:160] Backtrace: wlc/src/libwlc.so.0(+0x157b7) [0x7f70f3f2f7b7] src/compositor/seat/seat.c:166
[log.c:160] Backtrace: wlc/src/libwlc.so.0(+0x1b6dd) [0x7f70f3f356dd] /usr/include/wayland-server-core.h:329
[log.c:160] Backtrace: wlc/src/libwlc.so.0(+0x1bf18) [0x7f70f3f35f18] wlc/src/platform/backend/x11.c:224
[log.c:160] Backtrace: /usr/lib/libwayland-server.so.0(wl_event_loop_dispatch+0xc8) [0x7f70f3656888]
[log.c:160] Backtrace: /usr/lib/libwayland-server.so.0(wl_display_run+0x25) [0x7f70f3654ee5]
[log.c:160] Backtrace: wlc/src/libwlc.so.0(wlc_run+0xc3) [0x7f70f3f42967]
[log.c:160] Backtrace: sway(main+0x49f) [0x42050b] sway/sway/main.c:225
[log.c:160] Backtrace: /usr/lib/libc.so.6(__libc_start_main+0xf0) [0x7f70f2d9d710]
[log.c:160] Backtrace: sway(_start+0x29) [0x406b99]