]> git.mdlowis.com Git - proto/labwc.git/commit
graphic-helpers: fix segfault when medium-size icon file is loaded
authortokyo4j <hrak1529@gmail.com>
Tue, 26 Nov 2024 01:56:10 +0000 (10:56 +0900)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Tue, 26 Nov 2024 02:29:25 +0000 (03:29 +0100)
commita590795f7a342764d112d9bde223b55cb4a70f5f
tree49811ae3fc1e854f45f5ff2d6bce696fd719ad5d
parent6b7157f04617b258cc0a13cb8a4b89be5b73b73b
graphic-helpers: fix segfault when medium-size icon file is loaded

lab_data_buffer->logical_{width,height} are not the actual size of the
backing buffer, so wlr_buffer.{width,height} should be used when
duplicating it in get_cairo_surface_from_lab_data_buffer().

This mistake caused segfault when an icon file 1~2 times larger than
window.button.{width,height} is loaded, because the buffer for the raw
icon file is reused by setting lab_data_buffer->logical_{width,height}
with the size for display which is different from
wlr_buffer.{width,height} (see buffer_convert_cairo_surface_for_icon()),
and it is duplicated with get_cairo_surface_from_lab_data_buffer() for
hovered/rounded variants of titlebar button.
src/common/graphic-helpers.c