mirror of
https://github.com/swaywm/sway.git
synced 2026-04-03 07:15:39 -04:00
sway_text_node: fix cairo_create without a backing surface
This fixes sway not being able to draw text on text nodes. cairo_create(NULL) returns a nil object in an error state rather than NULL, causing the null check to never trigger and passing a broken cairo context to get_text_size, which was fine until40e1dcd29fadding error handling to it and causing pango_cairo_update_layout to fail with a NULL pointer. (cherry picked from commite4870d84a2)
This commit is contained in:
parent
948d481cfa
commit
9d77163d6e
1 changed files with 4 additions and 1 deletions
|
|
@ -198,7 +198,10 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
|
||||||
static void text_calc_size(struct text_buffer *buffer) {
|
static void text_calc_size(struct text_buffer *buffer) {
|
||||||
struct sway_text_node *props = &buffer->props;
|
struct sway_text_node *props = &buffer->props;
|
||||||
|
|
||||||
cairo_t *c = cairo_create(NULL);
|
cairo_surface_t *recorder = cairo_recording_surface_create(
|
||||||
|
CAIRO_CONTENT_COLOR_ALPHA, NULL);
|
||||||
|
cairo_t *c = cairo_create(recorder);
|
||||||
|
cairo_surface_destroy(recorder);
|
||||||
if (!c) {
|
if (!c) {
|
||||||
sway_log(SWAY_ERROR, "cairo_t allocation failed");
|
sway_log(SWAY_ERROR, "cairo_t allocation failed");
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue