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

Segfault when switching to stacking layout #3618

Closed
defau1t opened this issue Feb 7, 2019 · 4 comments
Closed

Segfault when switching to stacking layout #3618

defau1t opened this issue Feb 7, 2019 · 4 comments
Labels
bug Not working as intended

Comments

@defau1t
Copy link

defau1t commented Feb 7, 2019

All I do is press the key to enable stacking layout (tried various mods and keys) and sway segfaults.

Running $ swaymsg layout stacking works fine, but using a hotkey fails.

Might be relevant, might not: I am using the dvorak keyboard layout set through the sway.desktop file.

Relevant section from dmesg:
sway[19270]: segfault at 55cd6d375550 ip 000055d16c87d21f sp 00007ffc132872a0 error 4 in sway[55d16c84e000+3b000]

Code: d0 00 00 00 c5 fb 10 54 24 08 c5 f1 57 c9 c5 f3 2a ca c5 eb 5c c0 c5 fb 5e c1 c5 fb 2c d0 3b 50 04 7d 18 48 8b 40 08 48 63 d2 <48> 8b 04 d0 e9 28 fe ff ff 0f 1f 84 00 00 00 00 00 48 89 de 48 89

@RedSoxFan
Copy link
Member

Sway Version: 1.0_beta2

1.0-beta.2 was released over 2 months ago (Nov 29, 2018) and there has been numerous changes to the code base since then. Can you please try with git master?

@defau1t
Copy link
Author

defau1t commented Feb 8, 2019

Just installed rc1 and no dice. Only difference is offset in dmesg is now 40000 vice 3b000

EDIT: And just tried with git master, still segfaults.

EDIT2: And here's the backtrace:

#0  container_at_stacked (parent=0x558ee944e080, lx=100, ly=100, surface=0x7ffe54a840f0, sx=0x7ffe54a840f8, sy=0x7ffe54a84100) at ../sway/tree/container.c:256
#1  0x0000558ee8f87847 in tiling_container_at (parent=0x558ee944e080, lx=100, ly=100, surface=0x7ffe54a840f0, sx=0x7ffe54a840f8, sy=0x7ffe54a84100) at ../sway/tree/container.c:333
#2  0x0000558ee8f87a9f in container_at (workspace=0x558ee944e080, lx=100, ly=100, surface=0x7ffe54a840f0, sx=0x7ffe54a840f8, sy=0x7ffe54a84100) at ../sway/tree/container.c:396
#3  0x0000558ee8f66b1c in node_at_coords (seat=0x558ee9426a90, lx=100, ly=100, surface=0x7ffe54a840f0, sx=0x7ffe54a840f8, sy=0x7ffe54a84100) at ../sway/input/cursor.c:140
#4  0x0000558ee8f670ed in cursor_rebase (cursor=0x558ee9426ef0) at ../sway/input/cursor.c:281
#5  0x0000558ee8f5be9d in transaction_apply (transaction=0x558ee943fa30) at ../sway/desktop/transaction.c:321
#6  0x0000558ee8f5bfda in transaction_progress_queue () at ../sway/desktop/transaction.c:355
#7  0x0000558ee8f5c869 in transaction_commit_dirty () at ../sway/desktop/transaction.c:551
#8  0x0000558ee8f6bb18 in handle_keyboard_key (listener=0x558ee9439cf0, data=0x7ffe54a84350) at ../sway/input/keyboard.c:399
#9  0x00007f3224d0c99c in ?? () from /usr/lib64/libwlroots.so.0
#10 0x00007f3224cfd024 in wlr_keyboard_notify_key () from /usr/lib64/libwlroots.so.0
#11 0x00007f3224cdfd5c in ?? () from /usr/lib64/libwlroots.so.0
#12 0x00007f3222dd8425 in ?? () from /usr/lib64/libffi.so.7
#13 0x00007f3222dd7a7f in ?? () from /usr/lib64/libffi.so.7
#14 0x00007f32226fd0fd in ?? () from /usr/lib64/libwayland-client.so.0
#15 0x00007f32226f9ab9 in ?? () from /usr/lib64/libwayland-client.so.0
#16 0x00007f32226faf8c in wl_display_dispatch_queue_pending () from /usr/lib64/libwayland-client.so.0
#17 0x00007f32257c2bb2 in wl_event_loop_dispatch () from /usr/lib64/libwayland-server.so.0
#18 0x00007f32257c17da in wl_display_run () from /usr/lib64/libwayland-server.so.0
#19 0x0000558ee8f53f8f in server_run (server=0x558ee8fb4d00 <server>) at ../sway/server.c:212
#20 0x0000558ee8f534d8 in main (argc=1, argv=0x7ffe54a84aa8) at ../sway/main.c:395

@emersion emersion added the bug Not working as intended label Feb 8, 2019
@RedSoxFan
Copy link
Member

Full backtrace snippet:

#0  0x000055f70781b413 in container_at_stacked
    (parent=0x55f709099910, lx=100, ly=100, surface=0x7ffd0dcc0080, sx=0x7ffd0dcc0088, sy=0x7ffd0dcc0090) at ../sway/tree/container.c:256
        child = 0x7ffd0dcc0088
        box = {x = 10, y = 40, width = 1077, height = 567}
        seat = 0x55f708f3c340
        children = 0x55f708f7f250
        title_height = 0
        child_index = -2147483648
        current = 0x7ffd0dcc0080

Relevant source:

int title_height = container_titlebar_height();
int child_index = (ly - box.y) / title_height;

From your config:

font Hack 0px
titlebar_border_thickness 0
titlebar_padding 0 0

So it looks like you are using a font and padding that cause the title bars to be 0px tall, which is causing a division by zero, resulting in child_index getting set to INT_MIN (as close to negative infinity a 32-bit signed integer can get). I'll have a PR up to protect against this in a minute

@defau1t
Copy link
Author

defau1t commented Feb 9, 2019

I had initially set the titlebar to zero pixels to remove the titlebar completely, until I found the default_border command and never set those values back to normal. Thanks for helping out! Changing it back to non-zero fixes the issue, and still keeps my titlebars out of the way!

@defau1t defau1t closed this as completed Feb 9, 2019
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

3 participants