aboutsummaryrefslogtreecommitdiff
path: root/font.c
diff options
context:
space:
mode:
Diffstat (limited to 'font.c')
-rw-r--r--font.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/font.c b/font.c
index c5fd2629..7ea22f41 100644
--- a/font.c
+++ b/font.c
@@ -433,6 +433,7 @@ glyph_for_wchar(struct font *font, wchar_t wc, struct glyph *glyph)
err:
*glyph = (struct glyph){
+ .wc = wc,
.valid = false,
};
return false;
@@ -451,7 +452,7 @@ font_glyph_for_wc(struct font *font, wchar_t wc)
tll_foreach(*hash_entry, it) {
if (it->item.wc == wc) {
mtx_unlock(&font->lock);
- return &it->item;
+ return it->item.valid ? &it->item : NULL;
}
}
}
@@ -499,6 +500,9 @@ font_destroy(struct font *font)
continue;
tll_foreach(*font->cache[i], it) {
+ if (!it->item.valid)
+ continue;
+
cairo_surface_flush(it->item.surf);
void *image = cairo_image_surface_get_data(it->item.surf);