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 with titlebar_padding 1 10000 #8120

Open
mstoeckl opened this issue Apr 16, 2024 · 0 comments
Open

Crash with titlebar_padding 1 10000 #8120

mstoeckl opened this issue Apr 16, 2024 · 0 comments
Labels
bug Not working as intended

Comments

@mstoeckl
Copy link
Contributor

  • Description:

Sway crashes if one opens a window for which Sway draws a titlebar, and then runs swaymsg titlebar_padding 1 10000 to set the titlebar vertical padding to an extreme value, which would make the titlebar too tall/large to fit on screen.

For a screen height of about 1400 pixels, swaymsg titlebar_padding 1 500 works, but swaymsg titlebar_padding 1 1000 causes a crash.

  • Sway Version:

    • sway version 1.10-dev-087226d9 (Apr 16 2024, branch 'master')
  • Debug Log:

    • After opening a terminal with a titlebar, and running swaymsg titlebar_padding 1 10000
00:00:13.041 [sway/commands.c:260] Handling command 'titlebar_padding 1 10000'
00:00:13.041 [sway/tree/arrange.c:262] Usable area for ws: 851x1355@0,0
00:00:13.041 [sway/tree/arrange.c:296] Arranging workspace '1' at 0.000000, 0.000000
00:00:13.041 [sway/tree/arrange.c:76] Arranging 0x7ffeefcf9640 horizontally
00:00:13.041 [sway/desktop/transaction.c:786] Transaction 0x571533309410 committing with 2 instructions
sway: types/xdg_shell/wlr_xdg_toplevel.c:549: wlr_xdg_toplevel_set_size: Assertion `width >= 0 && height >= 0' failed.
00:00:13.157 [swaybar/bar.c:465] Wayland display poll error
  • Configuration File:
    • This works under the default config
    • The following minimal config file crashes on one of the first few frames after start:
titlebar_padding 1 10000
exec foot
  • Stack Trace:
(gdb) bt full
#0  __pthread_kill_implementation
    (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0)
    at pthread_kill.c:44
        tid = <optimized out>
        ret = 0
        pd = <optimized out>
        old_mask = {__val = {206158430256}}
        ret = <optimized out>
#1  0x0000768933a9a393 in __pthread_kill_internal (signo=6, threadid=<optimized out>)
    at pthread_kill.c:78
#2  0x0000768933a496c8 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
        ret = <optimized out>
#3  0x0000768933a314b8 in __GI_abort () at abort.c:79
        save_stage = 1
        act = {__sigaction_handler = {sa_handler = 0x20, sa_sigaction = 0x20}, sa_mask = {__val = {104794374295552, 104794377158464, 104794377158464, 104794374209552, 0, 10060338272, 0, 104794373553509, 0, 5, 140730917483920, 206158430224, 130331650490992, 18446744073709551064, 2, 130331652177616}}, sa_flags = 866815635, sa_restorer = 0x768933be4050 <_IO_file_jumps>}
#4  0x0000768933a313dc in __assert_fail_base
    (fmt=0x768933babb68 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x768933d3d84a "width >= 0 && height >= 0", file=file@entry=0x768933d4bed0 "types/xdg_shell/wlr_xdg_toplevel.c", line=line@entry=549, function=function@entry=0x768933d6b350 <__PRETTY_FUNCTION__.4> "wlr_xdg_toplevel_set_size") at assert.c:94
        str = 0x5f4f579fff40 "\277\317o\243J_"
        total = 4096
#5  0x0000768933a41d46 in __assert_fail
    (assertion=assertion@entry=0x768933d3d84a "width >= 0 && height >= 0", file=file@entry=0x768933d4bed0 "types/xdg_shell/wlr_xdg_toplevel.c", line=line@entry=549, function=function@entry=0x768933d6b350 <__PRETTY_FUNCTION__.4> "wlr_xdg_toplevel_set_size") at assert.c:103
#6  0x0000768933cfd14b in wlr_xdg_toplevel_set_size
    (toplevel=<optimized out>, width=<optimized out>, height=<optimized out>)
    at ../wlroots/types/xdg_shell/wlr_xdg_toplevel.c:549
        __PRETTY_FUNCTION__ = "wlr_xdg_toplevel_set_size"
#7  0x00005f4f5764d54a in transaction_commit (transaction=0x5f4f578f4ac0)
    at ../sway/sway/desktop/transaction.c:796
        instruction = 0x5f4f57a517a0
        node = 0x5f4f57a50cc0
        hidden = <optimized out>
        i = 1
#8  0x00005f4f5764f251 in transaction_commit_pending ()
    at ../sway/sway/desktop/transaction.c:848
        transaction = <optimized out>
        transaction = <optimized out>
#9  transaction_commit_pending () at ../sway/sway/desktop/transaction.c:841
        transaction = <optimized out>
        transaction = <optimized out>
#10 _transaction_commit_dirty (server_request=<optimized out>)
    at ../sway/sway/desktop/transaction.c:925
#11 0x00005f4f5764fb07 in handle_map (listener=0x5f4f57a4f7f8, data=<optimized out>)
    at ../sway/sway/desktop/xdg_shell.c:489
        xdg_shell_view = 0x5f4f57a4f600
        view = 0x5f4f57a4f600
        toplevel = 0x5f4f57a4f450
        csd = <optimized out>
--Type <RET> for more, q to quit, c to continue without paging--
#12 0x0000768933daa9fc in wl_signal_emit_mutable (signal=<optimized out>, data=0x0)
    at ../wayland/src/wayland-server.c:2243
        pos = 0x5f4f57a4f7f8
        l = 0x5f4f57a4f7f8
        cursor = {link = {prev = 0x5f4f57a4f7f8, next = 0x5f4f57a489c8}, notify = 0x768933da8760 <handle_noop>}
        end = {link = {prev = 0x5f4f57a00108, next = 0x5f4f57a49748}, notify = 0x768933da8760 <handle_noop>}
#13 0x0000768933d0071e in surface_commit_state (surface=0x5f4f57a49460, next=0x5f4f57a495e0)
    at ../wlroots/types/wlr_compositor.c:557
        __PRETTY_FUNCTION__ = "surface_commit_state"
        invalid_buffer = <optimized out>
        subsurface = 0x5f4f57a49550
#14 0x00007689333d0596 in ffi_call_unix64 () at ../src/x86/unix64.S:104
#15 0x00007689333cd00e in ffi_call_int
    (cif=cif@entry=0x7ffe78587a60, fn=<optimized out>, rvalue=<optimized out>, avalue=<optimized out>, closure=closure@entry=0x0) at ../src/x86/ffi64.c:673
        classes = {X86_64_INTEGER_CLASS, 32766, 859617100, 30345}
        stack = <optimized out>
        argp = 0x7ffe78587890 ""
        arg_types = <optimized out>
        gprcount = 2
        ssecount = <optimized out>
        ngpr = 1
        nsse = 0
        i = <optimized out>
        avn = <optimized out>
        flags = <optimized out>
        reg_args = <optimized out>
#16 0x00007689333cfbd3 in ffi_call
    (cif=cif@entry=0x7ffe78587a60, fn=<optimized out>, rvalue=rvalue@entry=0x0, avalue=avalue@entry=0x7ffe78587b30) at ../src/x86/ffi64.c:710
        arg_types = 0x7ffe78587a80
        i = <optimized out>
        nargs = 2
        max_reg_struct_size = <optimized out>
#17 0x0000768933daeb91 in wl_closure_invoke
    (closure=0x5f4f578eb9e0, flags=<optimized out>, target=<optimized out>, opcode=6, data=<optimized out>) at ../wayland/src/connection.c:1031
        count = 0
        cif = {abi = FFI_UNIX64, nargs = 2, arg_types = 0x7ffe78587a80, rtype = 0x7689333d11a0 <ffi_type_void>, bytes = 0, flags = 0}
        ffi_types = {0x7689333d12a0 <ffi_type_pointer>, 0x7689333d12a0 <ffi_type_pointer>, 0x7689333d12a0 <ffi_type_pointer>, 0x10, 0x768900000000, 0x7689333d1330 <ffi_type_sint32>, 0x7689333d1330 <ffi_type_sint32>, 0xd8, 0x5f4f57af5aa0, 0x25560, 0x768933be5ac0 <main_arena>, 0x0, 0xd8, 0x768933aa9848 <__libc_calloc+216>, 0x7ffe78587c80, 0x5f4f57a4d220, 0x768933db080d, 0x768933db6290 <wl_surface_requests+144>, 0x0, 0x5f4f5794c170, 0x0, 0x768933dada3d <wl_closure_init+93>}
        ffi_args = {0x7ffe78587a40, 0x7ffe78587a48, 0x5f4f578eb9f8, 0x5f4f578fcfb0, 0x8, 0x5f4f5794c140, 0x5f4f5794c170, 0x6, 0x768933db6290 <wl_surface_requests+144>, 0x768933dae443 <wl_connection_demarshal+163>, 0x5f4f578eb9e0, 0x5f4f57a4b210, 0x5f4f578ebab0, 0x800000000, 0x5f4f5794c140, 0x768933db6290 <wl_surface_requests+144>, 0x5f4f5794c170, 0x768933dae899 <wl_closure_lookup_objects+57>, 0x5f4f57a4d220, 0x768933da87b0 <log_closure+64>, 0x768933db6290 <wl_surface_requests+144>, 0x1}
--Type <RET> for more, q to quit, c to continue without paging--
        implementation = <optimized out>
#18 0x0000768933da9c3a in wl_client_connection_data
    (fd=<optimized out>, mask=<optimized out>, data=0x5f4f5794c140)
    at ../wayland/src/wayland-server.c:438
        client = <optimized out>
        connection = 0x5f4f57a4b210
        resource = 0x5f4f578fcfb0
        object = 0x5f4f578fcfb0
        closure = 0x5f4f578eb9e0
        message = 0x768933db6290 <wl_surface_requests+144>
        p = {3, 524294}
        resource_flags = <optimized out>
        opcode = 6
        size = <optimized out>
        since = <optimized out>
        len = <optimized out>
#19 0x0000768933daca12 in wl_event_loop_dispatch
    (loop=0x5f4f5773e870, timeout=<optimized out>, timeout@entry=-1)
    at ../wayland/src/event-loop.c:1104
        ep = {{events = 1, data = {ptr = 0x5f4f578f6550, fd = 1469015376, u32 = 1469015376, u64 = 104794376070480}}, {events = 2147483648, data = {ptr = 0x0, fd = 0, u32 = 0, u64 = 0}}, {events = 1877395200, data = {ptr = 0xb8e11fb1, fd = -1193205839, u32 = 3101761457, u64 = 3101761457}}, {events = 0, data = {ptr = 0x84, fd = 132, u32 = 132, u64 = 132}}, {events = 1470411280, data = {ptr = 0x78587d8000005f4f, fd = 24399, u32 = 24399, u64 = 8671819071211200335}}, {events = 32766, data = {ptr = 0x5f4f57a4e228, fd = 1470423592, u32 = 1470423592, u64 = 104794377478696}}, {events = 1470415384, data = {ptr = 0x100005f4f, fd = 24399, u32 = 24399, u64 = 4294991695}}, {events = 0, data = {ptr = 0x768933dad426 <wl_connection_flush+374>, fd = 869979174, u32 = 869979174, u64 = 130331652576294}}, {events = 0, data = {ptr = 0x8400000000, fd = 0, u32 = 0, u64 = 566935683072}}, {events = 0, data = {ptr = 0x7ffe78587dc0, fd = 2019065280, u32 = 2019065280, u64 = 140730917486016}}, {events = 0, data = {ptr = 0xa98, fd = 2712, u32 = 2712, u64 = 2712}}, {events = 0, data = {ptr = 0x0, fd = 0, u32 = 0, u64 = 0}}, {events = 2019065280, data = {ptr = 0x100007ffe, fd = 32766, u32 = 32766, u64 = 4295000062}}, {events = 0, data = {ptr = 0x7ffe78587de0, fd = 2019065312, u32 = 2019065312, u64 = 140730917486048}}, {events = 20, data = {ptr = 0x0, fd = 0, u32 = 0, u64 = 0}}, {events = 0, data = {ptr = 0x2, fd = 2, u32 = 2, u64 = 2}}, {events = 1470418096, data = {ptr = 0x8400005f4f, fd = 24399, u32 = 24399, u64 = 566935707471}}, {events = 0, data = {ptr = 0x5f4f5794c108, fd = 1469366536, u32 = 1469366536, u64 = 104794376421640}}, {events = 1466484492, data = {ptr = 0x1400005f4f, fd = 24399, u32 = 24399, u64 = 85899370319}}, {events = 0, data = {ptr = 0x100000001, fd = 1, u32 = 1, u64 = 4294967297}}, {events = 43, data = {ptr = 0x6fe6c70000007ffe, fd = 32766, u32 = 32766, u64 = 8063350985667411966}}, {events = 3101761457, data = {ptr = 0x0, fd = 0, u32 = 0, u64 = 0}}, {events = 0, data = {ptr = 0x5768f96300000000, fd = 0, u32 = 0, u64 = 6298558282474717184}}, {events = 24399, data = {ptr = 0x1ec, fd = 492, u32 = 492, u64 = 492}}, {events = 1468217552, data = {ptr = 0x700005f4f, fd = 24399, u32 = 24399, u64 = 30064795471}}, {events = 0, data = {ptr = 0x5f4f578f4d00, fd = 1469009152, u32 = 1469009152, u64 = 104794376064256}}, {events = 1877395200, data = {ptr = 0xfffffdd8b8e11fb1, fd = -1193205839, u32 = 3101761457, u64 = 18446741705989365681}}, {events = 4294967295, data = {ptr = 0x2, fd = 2, u32 = 2, u64 = 2}}, {events = 4294966744, data = {ptr = 0x2ffffffff, fd = -1, u32 = 4294967295, u64 = 12884901887}}, {events = 0, data = {ptr = 0x5f4f578f4ce0, fd = 1469009120, u32 = 1469009120, u64 = 104794376064224}}, {events = 1877395200, data = {ptr = 0x78588088b8e11fb1, fd = -1193205839, u32 = 3101761457, u64 = 8671822407207559089}}, {events = 32766, data = {ptr = 0x5f4f5794c140, fd = 1469366592, u32 = 1469366592, u64 = 104794376421696}}}
        source = <optimized out>
        i = 0
        count = <optimized out>
        has_timers = <optimized out>
        use_timeout = false
        now = {tv_sec = 1065353216, tv_nsec = 0}
        end = {tv_sec = <optimized out>, tv_nsec = <optimized out>}
#20 0x0000768933daa445 in wl_display_run (display=0x5f4f5773e780)
    at ../wayland/src/wayland-server.c:1493
#21 0x00005f4f57649df0 in server_run (server=server@entry=0x5f4f576b4a00 <server>)
    at ../sway/sway/server.c:494
#22 0x00005f4f5763d0d5 in main (argc=3, argv=0x7ffe78588088) at ../sway/sway/main.c:373
        verbose = false
        debug = false
        validate = false
        config_path = 0x5f4f5773e580 "/tmp/titlebar"
        c = <optimized out>

In particular, for the container the content_height = -18641

(gdb) frame 7
#7  0x00005f4f5764d54a in transaction_commit (transaction=0x5f4f578f4ac0)
    at ../sway/sway/desktop/transaction.c:796
796				instruction->serial = view_configure(node->sway_container->view,
(gdb) p *node->sway_container
$9 = {node = {type = N_CONTAINER, {sway_root = 0x5f4f57a50cc0, sway_output = 0x5f4f57a50cc0, 
      sway_workspace = 0x5f4f57a50cc0, sway_container = 0x5f4f57a50cc0}, id = 5, 
    instruction = 0x0, ntxnrefs = 1, destroying = false, dirty = false, events = {destroy = {
        listener_list = {prev = 0x5f4f578f7890, next = 0x5f4f578f7890}}}}, 
  view = 0x5f4f57a4f600, scene_tree = 0x5f4f578bfce0, title_bar = {tree = 0x5f4f578f90a0, 
    border = 0x5f4f578f92e0, background = 0x5f4f578ecb30, title_text = 0x5f4f57866920, 
    marks_text = 0x0}, border = {tree = 0x5f4f578c02d0, top = 0x5f4f578e4090, 
    bottom = 0x5f4f578e6510, left = 0x5f4f578e45d0, right = 0x5f4f578e4810}, 
  content_tree = 0x5f4f578c0510, output_handler = 0x5f4f57a50f40, output_enter = {link = {
      prev = 0x5f4f57a50fc8, next = 0x5f4f57a50fc8}, 
    notify = 0x5f4f5767b290 <handle_output_enter>}, output_leave = {link = {
      prev = 0x5f4f57a50fd8, next = 0x5f4f57a50fd8}, 
    notify = 0x5f4f5767b260 <handle_output_leave>}, current = {layout = L_NONE, x = 0, y = 0, 
    width = 0, height = 0, fullscreen_mode = FULLSCREEN_NONE, workspace = 0x0, parent = 0x0, 
    children = 0x0, focused_inactive_child = 0x0, focused = false, border = B_NONE, 
    border_thickness = 0, border_top = false, border_bottom = false, border_left = false, 
    border_right = false, content_x = 0, content_y = 0, content_width = 0, 
    content_height = 0}, pending = {layout = L_NONE, x = 0, y = 0, width = 1278, 
    height = 1380, fullscreen_mode = FULLSCREEN_NONE, workspace = 0x5f4f57944210, 
    parent = 0x0, children = 0x0, focused_inactive_child = 0x0, focused = false, 
    border = B_NORMAL, border_thickness = 2, border_top = true, border_bottom = true, 
    border_left = true, border_right = true, content_x = 2, content_y = 20019, 
    content_width = 1274, content_height = -18641}, title = 0x5f4f578f78b0 "foot", 
  formatted_title = 0x5f4f57a51200 "foot", title_width = 0, prev_split_layout = L_NONE, 
  is_sticky = false, saved_x = 0, saved_y = 0, saved_width = 0, saved_height = 0, 
  saved_border = B_NONE, width_fraction = 1, height_fraction = 0, child_total_width = 1278, 
  child_total_height = 0, scratchpad = false, transform = {x = 0, y = 0, width = 0, 
    height = 0}, alpha = 1, marks = 0x5f4f578f67b0, events = {destroy = {listener_list = {
        prev = 0x5f4f5
@mstoeckl mstoeckl added the bug Not working as intended label Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not working as intended
Development

No branches or pull requests

1 participant