mirror of
https://github.com/labwc/labwc.git
synced 2026-03-02 01:40:24 -05: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 *
|
static struct lab_data_buffer *
|
||||||
_create_buffer(struct scaled_scene_buffer *scaled_buffer, double scale)
|
_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;
|
struct scaled_font_buffer *self = scaled_buffer->data;
|
||||||
|
|
||||||
/* Buffer gets free'd automatically along the backing wlr_buffer */
|
/* Buffer gets free'd automatically along the backing wlr_buffer */
|
||||||
font_buffer_create(&buffer, self->max_width, self->text,
|
font_buffer_create(&buffer, self->max_width, self->text,
|
||||||
&self->font, self->color, self->bg_color, self->arrow, scale);
|
&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->width = buffer ? buffer->unscaled_width : 0;
|
||||||
self->height = buffer ? buffer->unscaled_height : 0;
|
self->height = buffer ? buffer->unscaled_height : 0;
|
||||||
return buffer;
|
return buffer;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue