Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Failed assertion when receiving key repeat event with no keyboard focus #2727

@jamii

Description

@jamii

(This is against tiawl/glfw.zig@a611b31, which has a different build setup but should otherwise be vanilla glfw 3.4. That might make repro hard, but I thought it was worth recording this somewhere anyway.)

I'm seeing a few crashes per day in:

focus: /home/jamie/focus/deps/glfw/glfw/src/input.c:274: void _glfwInputKey(_GLFWwindow *, int, int, int, int): Assertion `window != NULL' failed.
Set Windows Application User Model ID (AUMID) { AUMID: 'org.whispersystems.signal-desktop' }
NODE_ENV production
NODE_CONFIG_DIR /nix/store/s81a57m4lnr0l32n29v2ax22vqypw2vh-signal-desktop-7.56.1/share/signal-desktop/app.asar/config
NODE_CONFIG {}
ALLOW_CONFIG_MUTATIONS undefined
HOSTNAME vessel
NODE_APP_INSTANCE undefined
SUPPRESS_NO_CONFIG_WARNING undefined
SIGNAL_ENABLE_HTTP undefined
userData: /home/jamie/.config/Signal
config/get: Successfully read user config file
config/get: Successfully read ephemeral config fil

From the coredump, it looks like the problem is that glfw sometimes receives a key repeat event while there is no keyboard focus.

>>> bt
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007ffff7c99d43 in __pthread_kill_internal (threadid=<optimized out>, signo=6) at pthread_kill.c:78
#2  0x00007ffff7c413c6 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007ffff7c2893a in __GI_abort () at abort.c:79
#4  0x00007ffff7c2885e in __assert_fail_base (fmt=0x7ffff7dbdf20 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x103c61b "window != NULL",
    file=file@entry=0x10385f5 "/home/jamie/focus/deps/glfw/glfw/src/input.c", line=line@entry=274, function=function@entry=0x1057d3a "void _glfwInputKey(_GLFWwindow *, int, int, int, int)")
    at assert.c:96
#5  0x00007ffff7c395a6 in __assert_fail (assertion=0x103c61b "window != NULL", file=0x10385f5 "/home/jamie/focus/deps/glfw/glfw/src/input.c", line=274,
    function=0x1057d3a "void _glfwInputKey(_GLFWwindow *, int, int, int, int)") at assert.c:105
#6  0x0000000001230864 in _glfwInputKey (window=0x0, key=257, scancode=28, action=1, mods=0) at /home/jamie/focus/deps/glfw/glfw/src/input.c:274
#7  0x0000000001297ab8 in handleEvents (timeout=0x7fffffffb3a0) at /home/jamie/focus/deps/glfw/glfw/src/wl_window.c:1272
#8  0x0000000001296116 in _glfwPollEventsWayland () at /home/jamie/focus/deps/glfw/glfw/src/wl_window.c:2641
#9  0x000000000124f207 in glfwPollEvents () at /home/jamie/focus/deps/glfw/glfw/src/window.c:1142
#10 0x0000000001121a45 in lib.focus.App.frame (self=0x1b6f950) at /home/jamie/focus/lib/focus.zig:349
#11 lib.focus.run (server_socket=...) at /home/jamie/focus/lib/focus.zig:182
#12 0x000000000111ed1d in focus.main () at focus.zig:48
#13 start.callMain () at /nix/store/j3hylam3gxzrmzs52jcx18nfljsv1wgb-zig/lib/std/start.zig:647
#14 start.callMainWithArgs () at /nix/store/j3hylam3gxzrmzs52jcx18nfljsv1wgb-zig/lib/std/start.zig:616
#15 start.main (c_argc=<optimized out>, c_argv=<optimized out>, c_envp=<optimized out>) at /nix/store/j3hylam3gxzrmzs52jcx18nfljsv1wgb-zig/lib/std/start.zig:631

>>> f 7
#7  0x0000000001297ab8 in handleEvents (timeout=0x7fffffffb3a0) at /home/jamie/focus/deps/glfw/glfw/src/wl_window.c:1272
1272	                    _glfwInputKey(_glfw.wl.keyboardFocus,

>>> p _glfw.wl.keyboardFocus
$2 = (_GLFWwindow *) 0x0

This is running against niri 25.05.1 on nixos 25.05.804113.6c64dabd3aa8.

Exe and coredump, if that's helpful:
https://user.fm/files/v2-d73a56a78dfd17e74d59cbf96dde8574/dump
https://user.fm/files/v2-79ec0bda43172cb41d3f1e33f18fd6e7/focus

Metadata

Metadata

Assignees

Labels

WaylandbugBug reports and bugfix pull requestsinputKeyboard, joystick or mouse

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions