diff --git a/src/backend/wayland/wl_backend.c b/src/backend/wayland/wl_backend.c index 40af34e..93da985 100644 --- a/src/backend/wayland/wl_backend.c +++ b/src/backend/wayland/wl_backend.c @@ -8606,6 +8606,14 @@ static void wl_menu_paint_entry(WMenu *menu, int index, int selected) if (!fb || !fb->image) return; + /* Guard against painting before wMenuRealize: entry_height is 0, + * fb->image is the initial 1x10 placeholder, and the bevel-line + * computations below would write outside the pixman buffer. + * wMenuSetEnabled() in particular triggers paints on the brother + * during updateOptionsMenu before the menu is realized. */ + if (menu->entry_height <= 0 || fb->width <= 1 || fb->height <= 10) + return; + WScreen *scr = menu->frame->screen_ptr; WMenuEntry *entry = menu->entries[index]; int y = menu->entry_height * index;