revert unsafe titlebar resize: draw into parent frame instead

The in-place resize of titlebar pixman images continues to cause heap
corruption regardless of scene buffer detach order. Fall back to
drawing into the parent frame buffer when the titlebar is too narrow,
which is always safe since fb->image is already the correct size.
This commit is contained in:
lkn 2026-06-23 21:24:52 +02:00
parent 49a0b50a6d
commit 711ff08b57
1 changed files with 4 additions and 15 deletions

View File

@ -578,22 +578,11 @@ wl_frame_paint(struct WFrameWindow *fwin)
wlr_scene_node_set_position(&tb_fb->scene_buf->node, 0, 0);
}
/* Resize titlebar buffer if too narrow — detach from scene graph
* first so the old pixel data isn't accessed after being freed. */
/* If titlebar buffer is too narrow, draw directly into the
* parent frame buffer to avoid unsafe in-place resize. */
if (tb_fb && tb_fb->width < tb_w) {
if (tb_fb->scene_buf)
wlr_scene_buffer_set_buffer(tb_fb->scene_buf, NULL);
pixman_image_unref(tb_fb->image);
tb_fb->image = pixman_image_create_bits(PIXMAN_a8r8g8b8,
tb_w, tb_h, NULL, 0);
tb_fb->width = tb_w;
tb_fb->height = tb_h;
tb_fb->base.width = tb_w;
tb_fb->base.height = tb_h;
tb_img = tb_fb->image;
W_RegisterBacking(tb_fb->id, tb_fb->image);
if (tb_fb->scene_buf)
wlr_scene_buffer_set_dest_size(tb_fb->scene_buf, tb_w, tb_h);
tb_img = fb->image;
tb_fb = NULL;
}
WTexture *tex = fwin->title_texture[state];