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

SIGSEGV when moving cursor back to server/pressing any key #29

Closed
MultisampledNight opened this issue Jan 29, 2022 · 3 comments
Closed

Comments

@MultisampledNight
Copy link

MultisampledNight commented Jan 29, 2022

Waynergy crashes with a segmentation fault on moving the cursor back to the server (in this case, barrier), or pressing any key on the server while the cursor is on waynergy's side. I don't know if these are related in any way, but following the procedure in #16 I built in debug-mode and using bt in GDB I produced these two backtraces.

That one is when the cursor moves back to the server:

#0  0x000055ec59956a26 in wlKeyReleaseAll (ctx=0x55ec59978ee0 <wlContext>) at ../src/wl_input.c:134
#1  0x000055ec5995a52f in syn_active_cb (cookie=0x55ec59978fe0 <synNetContext>, active=false) at ../src/main.c:122
#2  0x000055ec5996441b in sProcessMessage (context=0x55ec599689c0 <synContext>, msg=0x7ffdef1644c0) at ../src/uSynergy.c:424
#3  0x000055ec599656de in sUpdateContext (context=0x55ec599689c0 <synContext>) at ../src/uSynergy.c:759
#4  0x000055ec599658d3 in uSynergyUpdate (context=0x55ec599689c0 <synContext>) at ../src/uSynergy.c:823
#5  0x000055ec5995fdb3 in netPoll (snet_ctx=0x55ec59978fe0 <synNetContext>, wl_ctx=0x55ec59978ee0 <wlContext>)
    at ../src/net.c:214
#6  0x000055ec5995ad6e in main (argc=11, argv=0x7ffdef1647c8) at ../src/main.c:315

And that one is when pressing any key server-side:

#0  0x000055db82cc282f in wlKey (ctx=0x55db82ce4ee0 <wlContext>, key=133, state=1) at ../src/wl_input.c:110
#1  0x000055db82cc6269 in syn_key_cb (cookie=0x55db82ce4fe0 <synNetContext>, key=133, mod=0, down=true, repeat=false)
    at ../src/main.c:71
#2  0x000055db82ccf7bf in sSendKeyboardCallback (context=0x55db82cd49c0 <synContext>, key=133, modifiers=0, down=true,
    repeat=false) at ../src/uSynergy.c:214
#3  0x000055db82cd0896 in sProcessMessage (context=0x55db82cd49c0 <synContext>, msg=0x7ffe175ac640) at ../src/uSynergy.c:494
#4  0x000055db82cd16de in sUpdateCon#0  0x000055ec59956a26 in wlKeyReleaseAll (ctx=0x55ec59978ee0 <wlContext>) at ../src/wl_input.c:134
#1  0x000055ec5995a52f in syn_active_cb (cookie=0x55ec59978fe0 <synNetContext>, active=false) at ../src/main.c:122
#2  0x000055ec5996441b in sProcessMessage (context=0x55ec599689c0 <synContext>, msg=0x7ffdef1644c0) at ../src/uSynergy.c:424
#3  0x000055ec599656de in sUpdateContext (context=0x55ec599689c0 <synContext>) at ../src/uSynergy.c:759
#4  0x000055ec599658d3 in uSynergyUpdate (context=0x55ec599689c0 <synContext>) at ../src/uSynergy.c:823
#5  0x000055ec5995fdb3 in netPoll (snet_ctx=0x55ec59978fe0 <synNetContext>, wl_ctx=0x55ec59978ee0 <wlContext>)
    at ../src/net.c:214
#6  0x000055ec5995ad6e in main (argc=11, argv=0x7ffdef1647c8) at ../src/main.c:315text (context=0x55db82cd49c0 <synContext>) at ../src/uSynergy.c:759
#5  0x000055db82cd18d3 in uSynergyUpdate (context=0x55db82cd49c0 <synContext>) at ../src/uSynergy.c:823
#6  0x000055db82ccbdb3 in netPoll (snet_ctx=0x55db82ce4fe0 <synNetContext>, wl_ctx=0x55db82ce4ee0 <wlContext>)
    at ../src/net.c:214
#7  0x000055db82cc6d6e in main (argc=11, argv=0x7ffe175ac948) at ../src/main.c:315

This is an assumption by someone who barely used C in any true fashion, but both seem to involve ctx being NULL, so I figured both backtraces belong in one issue.

EDIT: I'm running sway on Arch Linux, launching waynergy through

waynergy --backend wlr --host spacestation --port 24800 --enable-crypto --enable-tofu --name spacepod
@MultisampledNight
Copy link
Author

Just ran waynergy through rr record and I correct myself, no, ctx is not NULL, it's a perfectly fine struct. What's more of a matter is that wlContext->input.key_press_state is indeed NULL:

Breakpoint 1, syn_active_cb (cookie=0x55f04d770fe0 <synNetContext>, active=true) at ../src/main.c:121
121		if (!active) {
(rr) p wlContext
$1 = {registry = 0x55f04ee30c50, display = 0x55f04ee2cab0, seat = 0x55f04ee32b70, input = {state = 0x55f04ee33700,
    key_press_state = 0x0, key_count = 255, xkb_key_offset = 0, xkb_ctx = 0x55f04ee31f60, xkb_map = 0x55f04ee33a20,
    xkb_state = 0x55f04ee46de0, raw_keymap = 0x0, wl_ctx = 0x55f04d770ee0 <wlContext>,
    mouse_rel_motion = 0x55f04d74f49c <mouse_rel_motion>, mouse_motion = 0x55f04d74f528 <mouse_motion>,
    mouse_button = 0x55f04d74f5d2 <mouse_button>, mouse_wheel = 0x55f04d74f6aa <mouse_wheel>, key = 0x55f04d74f3ac <key>,
    key_map = 0x55f04d74f31e <key_map>}, uinput_fd = {-1, 0}, keyboard_manager = 0x55f04ee31920,
  pointer_manager = 0x55f04ee319c0, fake_input = 0x0, output_manager = 0x55f04ee33890, outputs = 0x55f04ee33990,
  idle_manager = 0x55f04ee33930, idle_timeout = 0x55f04ee67680, width = 1128, height = 752, epoch = 0,
  on_output_update = 0x55f04d7523c4 <wl_output_update_cb>}

r-c-f added a commit that referenced this issue Jan 29, 2022
Initialize the key state tracking in the proper place -- after the raw
keymap has (tried) to load, because it may increase the actual maximum
keycode we expect, but also outside that function, because it returning
early causes a segfault when no raw keymap is provided. Should alleviate
issue #29
@r-c-f
Copy link
Owner

r-c-f commented Jan 29, 2022

That is now corrected indeed.

@MultisampledNight
Copy link
Author

MultisampledNight commented Jan 29, 2022

Waynergy works great now, thanks! Only thing that's on my side is that the keymap seems to get lost, but that's not your problem. Thanks again!

EDIT: And I figured out the keymap, too. Now my system successfully gained another screen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants