WillPower3309 / swayfx

SwayFX: Sway, but with eye candy!
MIT License
1.2k stars 47 forks source link

Repeatable SwayFX Crash #177

Closed ldelossa closed 1 year ago

ldelossa commented 1 year ago

Please read the following before submitting:

Please fill out the following:

https://github.com/ldelossa/dotfiles/blob/5079a865afa780792475aecb20e3936b5061dec8/config/sway/config

This is reproducible every time.

Open a scratch pad window.

Hide it so that it is not seen on the desktop

Bring it back into focus

Now make it a child node and change that child node to tab (for me mod+v, mod+t).

This crashes swayfx.

Working on getting the log of the crash, can do that in a bit.

ldelossa commented 1 year ago

On second look, it seems like any other manipulation of the scratch window crashes fx, such as opening another window below or to the side.

This obviously works fine with Sway.

ldelossa commented 1 year ago

Segfault occurs inside this function, after creating a container for scratch pad: https://github.com/ldelossa/swayfx/blob/c95306fcdf6fc11d4dd39309b392c0954784970a/sway/tree/root.c#L112

gdb backtrace:

(gdb) backtrace
#0  0x000055bf89e83136 in root_scratchpad_set_minimize ()
#1  0x000055bf89e891fd in root_scratchpad_add_container ()
#2  0x000055bf89e82c51 in container_replace ()
#3  0x000055bf89e82dc9 in container_split ()
#4  0x000055bf89e7314d in do_split ()
#5  0x000055bf89e384bb in execute_command ()
#6  0x000055bf89e6a35c in seat_execute_command ()
#7  0x000055bf89e54c2b in handle_key_event ()
#8  0x00007f01e9a26dcc in wl_signal_emit_mutable (signal=signal@entry=0x55bf8aacad78, data=data@entry=0x7ffea07e6a70)
    at ../src/wayland-server.c:2241
#9  0x00007f01e9995345 in wlr_keyboard_notify_key (keyboard=0x55bf8aacac40, event=0x7ffea07e6a70)
    at ../types/wlr_keyboard.c:102
#10 0x00007f01e9a26dcc in wl_signal_emit_mutable (signal=signal@entry=0x55bf8ae8bed0, data=data@entry=0x7ffea07e6a70)
    at ../src/wayland-server.c:2241
#11 0x00007f01e9995345 in wlr_keyboard_notify_key (keyboard=0x55bf8ae8bd98, event=0x7ffea07e6a70)
    at ../types/wlr_keyboard.c:102
#12 0x00007f01e996a7ef in handle_keyboard_key (kb=0x55bf8ae8bd98, event=0x55bf8c5b2310) at ../backend/libinput/keyboard.c:54
#13 handle_libinput_event (event=0x55bf8c5b2310, backend=<optimized out>) at ../backend/libinput/events.c:165
#14 handle_libinput_readable (fd=<optimized out>, mask=<optimized out>, _backend=<optimized out>)
    at ../backend/libinput/backend.c:58
#15 handle_libinput_readable (fd=<optimized out>, mask=<optimized out>, _backend=0x55bf89f89c40)
    at ../backend/libinput/backend.c:48
#16 0x00007f01e9a288e2 in wl_event_loop_dispatch (loop=0x55bf89f88100, timeout=timeout@entry=-1) at ../src/event-loop.c:1027
#17 0x00007f01e9a29125 in wl_display_run (display=0x55bf89f88010) at ../src/wayland-server.c:1493
#18 0x000055bf89e31509 in main ()

From segfault digging I realized I can just do scratchpad_minimize disable and my issue is fixed. By the code looks like adding a container to scratchpad should be supported.

ldelossa commented 1 year ago

Just a heads up. I'm getting a lot of crashes when I try to make any type of complex window hierarchy.

For instance, if I try to open a window, make it a tabbed container, then create an additional vertical window within the tab container, swayfx will crash.

Maybe worth just playing around with making various different window layouts and see if swayfx crashes.

emanuelserpa commented 1 year ago

I'm getting the same problem, @ldelossa.

It is impossible to do something like this on SwayFX atm.

image

To be fair, playing with such intricate hierarchies can crash mainline sway too, but it is impossible to get semi-complex ones in SwayFX.

ldelossa commented 1 year ago

To be fair, playing with such intricate hierarchies can crash mainline sway too, but it is impossible to get semi-complex ones in SwayFX.

Can't say I have ever had Sway proper crash on me, no matter how crazy I nest my windows, and I'd consider myself a "power user"

But yes. I wanted to investigate further, but I have trouble building SwayFX.

~/git/c/swayfx/swayfx master
0 🖳  ninja -C build   
ninja: Entering directory `build'
[1/1] Linking target sway/sway
FAILED: sway/sway 
/usr/bin/clang  -o sway/sway sway/sway.p/meson-generated_.._.._protocols_xdg-shell-protocol.c.o sway/sway.p/meson-generated_.._.._protocols_xdg-output-unstable-v1-protocol.c.o sway/sway.p/meson-generated_.._.._protocols_pointer-constraints-unstable-v1-protocol.c.o sway/sway.p/meson-generated_.._.._protocols_tablet-unstable-v2-protocol.c.o sway/sway.p/meson-generated_.._.._protocols_linux-dmabuf-unstable-v1-protocol.c.o sway/sway.p/meson-generated_.._.._protocols_wlr-layer-shell-unstable-v1-protocol.c.o sway/sway.p/meson-generated_.._.._protocols_idle-protocol.c.o sway/sway.p/meson-generated_.._.._protocols_wlr-input-inhibitor-unstable-v1-protocol.c.o sway/sway.p/meson-generated_.._.._protocols_wlr-output-power-management-unstable-v1-protocol.c.o sway/sway.p/commands.c.o sway/sway.p/config.c.o sway/sway.p/criteria.c.o sway/sway.p/decoration.c.o sway/sway.p/ipc-json.c.o sway/sway.p/ipc-server.c.o sway/sway.p/layer_criteria.c.o sway/sway.p/lock.c.o sway/sway.p/main.c.o sway/sway.p/realtime.c.o sway/sway.p/server.c.o sway/sway.p/swaynag.c.o sway/sway.p/xdg_activation_v1.c.o sway/sway.p/xdg_decoration.c.o sway/sway.p/desktop_desktop.c.o sway/sway.p/desktop_fx_renderer_fx_framebuffer.c.o sway/sway.p/desktop_fx_renderer_fx_renderer.c.o sway/sway.p/desktop_fx_renderer_fx_texture.c.o sway/sway.p/desktop_fx_renderer_matrix.c.o sway/sway.p/desktop_idle_inhibit_v1.c.o sway/sway.p/desktop_layer_shell.c.o sway/sway.p/desktop_output.c.o sway/sway.p/desktop_render.c.o sway/sway.p/desktop_surface.c.o sway/sway.p/desktop_transaction.c.o sway/sway.p/desktop_xdg_shell.c.o sway/sway.p/desktop_launcher.c.o sway/sway.p/input_input-manager.c.o sway/sway.p/input_cursor.c.o sway/sway.p/input_keyboard.c.o sway/sway.p/input_libinput.c.o sway/sway.p/input_seat.c.o sway/sway.p/input_seatop_default.c.o sway/sway.p/input_seatop_down.c.o sway/sway.p/input_seatop_move_floating.c.o sway/sway.p/input_seatop_move_tiling.c.o sway/sway.p/input_seatop_resize_floating.c.o sway/sway.p/input_seatop_resize_tiling.c.o sway/sway.p/input_switch.c.o sway/sway.p/input_tablet.c.o sway/sway.p/input_text_input.c.o sway/sway.p/config_bar.c.o sway/sway.p/config_output.c.o sway/sway.p/config_seat.c.o sway/sway.p/config_input.c.o sway/sway.p/commands_assign.c.o sway/sway.p/commands_bar.c.o sway/sway.p/commands_bind.c.o sway/sway.p/commands_blur.c.o sway/sway.p/commands_blur_passes.c.o sway/sway.p/commands_blur_radius.c.o sway/sway.p/commands_blur_xray.c.o sway/sway.p/commands_border.c.o sway/sway.p/commands_client.c.o sway/sway.p/commands_corner_radius.c.o sway/sway.p/commands_smart_corner_radius.c.o sway/sway.p/commands_create_output.c.o sway/sway.p/commands_default_border.c.o sway/sway.p/commands_default_dim_inactive.c.o sway/sway.p/commands_default_floating_border.c.o sway/sway.p/commands_default_orientation.c.o sway/sway.p/commands_dim_inactive.c.o sway/sway.p/commands_dim_inactive_colors.c.o sway/sway.p/commands_exit.c.o sway/sway.p/commands_exec.c.o sway/sway.p/commands_exec_always.c.o sway/sway.p/commands_floating.c.o sway/sway.p/commands_floating_minmax_size.c.o sway/sway.p/commands_floating_modifier.c.o sway/sway.p/commands_focus.c.o sway/sway.p/commands_focus_follows_mouse.c.o sway/sway.p/commands_focus_on_window_activation.c.o sway/sway.p/commands_focus_wrapping.c.o sway/sway.p/commands_font.c.o sway/sway.p/commands_for_window.c.o sway/sway.p/commands_force_display_urgency_hint.c.o sway/sway.p/commands_force_focus_wrapping.c.o sway/sway.p/commands_fullscreen.c.o sway/sway.p/commands_gaps.c.o sway/sway.p/commands_gesture.c.o sway/sway.p/commands_hide_edge_borders.c.o sway/sway.p/commands_inhibit_idle.c.o sway/sway.p/commands_kill.c.o sway/sway.p/commands_mark.c.o sway/sway.p/commands_max_render_time.c.o sway/sway.p/commands_opacity.c.o sway/sway.p/commands_include.c.o sway/sway.p/commands_input.c.o sway/sway.p/commands_layout.c.o sway/sway.p/commands_layer_effects.c.o sway/sway.p/commands_mode.c.o sway/sway.p/commands_mouse_warping.c.o sway/sway.p/commands_move.c.o sway/sway.p/commands_new_float.c.o sway/sway.p/commands_new_window.c.o sway/sway.p/commands_no_focus.c.o sway/sway.p/commands_nop.c.o sway/sway.p/commands_output.c.o sway/sway.p/commands_popup_during_fullscreen.c.o sway/sway.p/commands_reload.c.o sway/sway.p/commands_rename.c.o sway/sway.p/commands_resize.c.o sway/sway.p/commands_saturation.c.o sway/sway.p/commands_scratchpad.c.o sway/sway.p/commands_scratchpad_minimize.c.o sway/sway.p/commands_seat.c.o sway/sway.p/commands_seat_attach.c.o sway/sway.p/commands_seat_cursor.c.o sway/sway.p/commands_seat_fallback.c.o sway/sway.p/commands_seat_hide_cursor.c.o sway/sway.p/commands_seat_idle.c.o sway/sway.p/commands_seat_keyboard_grouping.c.o sway/sway.p/commands_seat_pointer_constraint.c.o sway/sway.p/commands_seat_shortcuts_inhibitor.c.o sway/sway.p/commands_seat_xcursor_theme.c.o sway/sway.p/commands_titlebar_separator.c.o sway/sway.p/commands_set.c.o sway/sway.p/commands_shadow_blur_radius.c.o sway/sway.p/commands_shadow_color.c.o sway/sway.p/commands_shadows.c.o sway/sway.p/commands_shadows_on_csd.c.o sway/sway.p/commands_show_marks.c.o sway/sway.p/commands_shortcuts_inhibitor.c.o sway/sway.p/commands_smart_borders.c.o sway/sway.p/commands_smart_gaps.c.o sway/sway.p/commands_split.c.o sway/sway.p/commands_sticky.c.o sway/sway.p/commands_swaybg_command.c.o sway/sway.p/commands_swaynag_command.c.o sway/sway.p/commands_swap.c.o sway/sway.p/commands_tiling_drag.c.o sway/sway.p/commands_tiling_drag_threshold.c.o sway/sway.p/commands_title_align.c.o sway/sway.p/commands_title_format.c.o sway/sway.p/commands_titlebar_border_thickness.c.o sway/sway.p/commands_titlebar_padding.c.o sway/sway.p/commands_unmark.c.o sway/sway.p/commands_urgent.c.o sway/sway.p/commands_workspace.c.o sway/sway.p/commands_workspace_layout.c.o sway/sway.p/commands_ws_auto_back_and_forth.c.o sway/sway.p/commands_xwayland.c.o sway/sway.p/commands_bar_bind.c.o sway/sway.p/commands_bar_binding_mode_indicator.c.o sway/sway.p/commands_bar_colors.c.o sway/sway.p/commands_bar_font.c.o sway/sway.p/commands_bar_gaps.c.o sway/sway.p/commands_bar_height.c.o sway/sway.p/commands_bar_hidden_state.c.o sway/sway.p/commands_bar_icon_theme.c.o sway/sway.p/commands_bar_id.c.o sway/sway.p/commands_bar_mode.c.o sway/sway.p/commands_bar_modifier.c.o sway/sway.p/commands_bar_output.c.o sway/sway.p/commands_bar_pango_markup.c.o sway/sway.p/commands_bar_position.c.o sway/sway.p/commands_bar_separator_symbol.c.o sway/sway.p/commands_bar_status_command.c.o sway/sway.p/commands_bar_status_edge_padding.c.o sway/sway.p/commands_bar_status_padding.c.o sway/sway.p/commands_bar_strip_workspace_numbers.c.o sway/sway.p/commands_bar_strip_workspace_name.c.o sway/sway.p/commands_bar_swaybar_command.c.o sway/sway.p/commands_bar_tray_bind.c.o sway/sway.p/commands_bar_tray_output.c.o sway/sway.p/commands_bar_tray_padding.c.o sway/sway.p/commands_bar_workspace_buttons.c.o sway/sway.p/commands_bar_workspace_min_width.c.o sway/sway.p/commands_bar_wrap_scroll.c.o sway/sway.p/commands_input_accel_profile.c.o sway/sway.p/commands_input_calibration_matrix.c.o sway/sway.p/commands_input_click_method.c.o sway/sway.p/commands_input_drag.c.o sway/sway.p/commands_input_drag_lock.c.o sway/sway.p/commands_input_dwt.c.o sway/sway.p/commands_input_dwtp.c.o sway/sway.p/commands_input_events.c.o sway/sway.p/commands_input_left_handed.c.o sway/sway.p/commands_input_map_from_region.c.o sway/sway.p/commands_input_map_to_output.c.o sway/sway.p/commands_input_map_to_region.c.o sway/sway.p/commands_input_middle_emulation.c.o sway/sway.p/commands_input_natural_scroll.c.o sway/sway.p/commands_input_pointer_accel.c.o sway/sway.p/commands_input_repeat_delay.c.o sway/sway.p/commands_input_repeat_rate.c.o sway/sway.p/commands_input_scroll_button.c.o sway/sway.p/commands_input_scroll_factor.c.o sway/sway.p/commands_input_scroll_method.c.o sway/sway.p/commands_input_tap.c.o sway/sway.p/commands_input_tap_button_map.c.o sway/sway.p/commands_input_tool_mode.c.o sway/sway.p/commands_input_xkb_capslock.c.o sway/sway.p/commands_input_xkb_file.c.o sway/sway.p/commands_input_xkb_layout.c.o sway/sway.p/commands_input_xkb_model.c.o sway/sway.p/commands_input_xkb_numlock.c.o sway/sway.p/commands_input_xkb_options.c.o sway/sway.p/commands_input_xkb_rules.c.o sway/sway.p/commands_input_xkb_switch_layout.c.o sway/sway.p/commands_input_xkb_variant.c.o sway/sway.p/commands_output_adaptive_sync.c.o sway/sway.p/commands_output_background.c.o sway/sway.p/commands_output_disable.c.o sway/sway.p/commands_output_dpms.c.o sway/sway.p/commands_output_enable.c.o sway/sway.p/commands_output_max_render_time.c.o sway/sway.p/commands_output_mode.c.o sway/sway.p/commands_output_position.c.o sway/sway.p/commands_output_power.c.o sway/sway.p/commands_output_render_bit_depth.c.o sway/sway.p/commands_output_scale.c.o sway/sway.p/commands_output_scale_filter.c.o sway/sway.p/commands_output_subpixel.c.o sway/sway.p/commands_output_toggle.c.o sway/sway.p/commands_output_transform.c.o sway/sway.p/commands_output_unplug.c.o sway/sway.p/tree_arrange.c.o sway/sway.p/tree_container.c.o sway/sway.p/tree_node.c.o sway/sway.p/tree_root.c.o sway/sway.p/tree_view.c.o sway/sway.p/tree_workspace.c.o sway/sway.p/tree_output.c.o sway/sway.p/desktop_xwayland.c.o -Wl,--as-needed -Wl,--no-undefined '-Wl,-rpath,$ORIGIN/../subprojects/wlroots' -Wl,-rpath-link,/home/louis/git/c/swayfx/swayfx/build/subprojects/wlroots -Wl,--start-group common/libsway-common.a subprojects/wlroots/libwlroots.so.11 /usr/lib64/libcairo.so /usr/lib64/libjson-c.so /usr/lib64/libevdev.so /usr/lib64/libinput.so /usr/lib64/libudev.so -lm /usr/lib64/libpango-1.0.so /usr/lib64/libgobject-2.0.so /usr/lib64/libglib-2.0.so /usr/lib64/libharfbuzz.so /usr/lib64/libpcre2-8.so /usr/lib64/libGLESv2.so /usr/lib64/libpixman-1.so -pthread /usr/lib64/libwayland-server.so /usr/lib64/libdrm.so /usr/lib64/libxkbcommon.so -lrt /usr/lib64/libxcb.so /usr/lib64/libxcb-dri3.so /usr/lib64/libxcb-present.so /usr/lib64/libxcb-render.so /usr/lib64/libxcb-render-util.so /usr/lib64/libxcb-shm.so /usr/lib64/libxcb-xfixes.so /usr/lib64/libxcb-xinput.so /usr/lib64/libwayland-client.so /usr/lib64/libseat.so /usr/lib64/libxcb-composite.so /usr/lib64/libxcb-icccm.so /usr/lib64/libxcb-res.so /usr/lib64/libEGL.so /usr/lib64/libgdk_pixbuf-2.0.so /usr/lib64/libpangocairo-1.0.so -Wl,--end-group
/usr/bin/ld: sway/sway.p/desktop_fx_renderer_fx_renderer.c.o: in function `fx_renderer_create':
/home/louis/git/c/swayfx/swayfx/build/../sway/desktop/fx_renderer/fx_renderer.c:262: undefined reference to `wlr_egl_get_display'
/usr/bin/ld: /home/louis/git/c/swayfx/swayfx/build/../sway/desktop/fx_renderer/fx_renderer.c:263: undefined reference to `wlr_egl_get_context'
/usr/bin/ld: /home/louis/git/c/swayfx/swayfx/build/../sway/desktop/fx_renderer/fx_renderer.c:350: undefined reference to `wlr_egl_get_display'
/usr/bin/ld: /home/louis/git/c/swayfx/swayfx/build/../sway/desktop/fx_renderer/fx_renderer.c:375: undefined reference to `wlr_egl_get_display'
/usr/bin/ld: sway/sway.p/desktop_fx_renderer_fx_texture.c.o: in function `fx_texture_from_wlr_texture':
/home/louis/git/c/swayfx/swayfx/build/../sway/desktop/fx_renderer/fx_texture.c:7: undefined reference to `wlr_texture_is_gles2'
/usr/bin/ld: /home/louis/git/c/swayfx/swayfx/build/../sway/desktop/fx_renderer/fx_texture.c:10: undefined reference to `wlr_gles2_texture_get_attribs'
/usr/bin/ld: sway/sway.p/desktop_output.c.o: in function `handle_new_output':
/home/louis/git/c/swayfx/swayfx/build/../sway/desktop/output.c:985: undefined reference to `wlr_gles2_renderer_get_egl'
/usr/bin/ld: sway/sway.p/desktop_render.c.o: in function `render_saved_view':
/home/louis/git/c/swayfx/swayfx/build/../sway/desktop/render.c:802: undefined reference to `wlr_gles2_texture_get_attribs'
clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

Unfortunately, I dont know how to get SwayFX to link against subprojects/wlroots where the objs which contain the above references exist :(

emanuelserpa commented 1 year ago

Yeah. You don't need much to crash Swayfx.

splith or splitv inside a tab and it will crash.

2 windows, tab mode and split inside one of the tabs.

Can't say I have ever had Sway proper crash on me, no matter how crazy I nest my windows, and I'd consider myself a "power user"

Yeah, it is pretty rare to happen, but already happened to be once or twice. Doesn't seem to be reproducible like Swayfx.

WillPower3309 commented 1 year ago

Fixed by #180

WillPower3309 commented 1 year ago

Apologies, will be fixed by #182