mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
scaled-font-buffer.c: initialize buffer to avoid bug waiting to happen
This commit is contained in:
parent
9bc381d9e8
commit
107d84cef9
1 changed files with 5 additions and 1 deletions
|
|
@ -14,13 +14,17 @@
|
|||
static struct lab_data_buffer *
|
||||
_create_buffer(struct scaled_scene_buffer *scaled_buffer, double scale)
|
||||
{
|
||||
struct lab_data_buffer *buffer;
|
||||
struct lab_data_buffer *buffer = NULL;
|
||||
struct scaled_font_buffer *self = scaled_buffer->data;
|
||||
|
||||
/* Buffer gets free'd automatically along the backing wlr_buffer */
|
||||
font_buffer_create(&buffer, self->max_width, self->text,
|
||||
&self->font, self->color, self->bg_color, self->arrow, scale);
|
||||
|
||||
if (!buffer) {
|
||||
wlr_log(WLR_ERROR, "font_buffer_create() failed");
|
||||
}
|
||||
|
||||
self->width = buffer ? buffer->unscaled_width : 0;
|
||||
self->height = buffer ? buffer->unscaled_height : 0;
|
||||
return buffer;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue