Merge pull request #3 from droyo/wayland-segfault

Fix unexpected devdraw crashes on sway
This commit is contained in:
Ethan Burns 2025-02-02 09:11:09 -05:00 committed by GitHub
commit f9430786f0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -616,8 +616,13 @@ static const struct wl_pointer_listener pointer_listener = {
void wl_keyboard_keymap(void *data, struct wl_keyboard *wl_keyboard, void wl_keyboard_keymap(void *data, struct wl_keyboard *wl_keyboard,
uint32_t format, int32_t fd, uint32_t size) { uint32_t format, int32_t fd, uint32_t size) {
DEBUG("wl_keyboard_keymap\n"); DEBUG("wl_keyboard_keymap(format=%d, fd=%d, size=%d)\n", format, fd, size);
char *keymap = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0); char *keymap = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);
if (keymap == MAP_FAILED) {
DEBUG("wl_keyboard_keymap: %s", strerror(errno));
return;
}
Client* c = data; Client* c = data;
WaylandClient *wl = (WaylandClient*) c->view; WaylandClient *wl = (WaylandClient*) c->view;
qlock(&wayland_lock); qlock(&wayland_lock);
@ -852,8 +857,9 @@ void gfx_main(void) {
entered_gfx_loop = 1; entered_gfx_loop = 1;
gfx_started(); gfx_started();
DEBUG("gfx_main: entering loop\n"); DEBUG("gfx_main: entering loop\n");
while (wl_display_dispatch(wl_display)) while (wl_display_dispatch(wl_display) > 0 || errno == EAGAIN)
; ;
sysfatal("wl_display_dispatch: %r");
} }
static void rpc_resizeimg(Client*) { static void rpc_resizeimg(Client*) {