From c4a788b67bb4906a4e7ce2ed1c541288dc155e06 Mon Sep 17 00:00:00 2001 From: Hans Petter Jansson Date: Tue, 3 Jan 2023 19:55:27 -0600 Subject: [PATCH] ChafaSymbolMap: Fix crash caused by incomplete copy of prepared map Reported by @GuardKenzie. Fixes #123 (GitHub). --- chafa/chafa-symbol-map.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/chafa/chafa-symbol-map.c b/chafa/chafa-symbol-map.c index b97a756d..d4cc9ab8 100644 --- a/chafa/chafa-symbol-map.c +++ b/chafa/chafa-symbol-map.c @@ -1009,11 +1009,16 @@ chafa_symbol_map_copy_contents (ChafaSymbolMap *dest, const ChafaSymbolMap *src) dest->glyphs2 = copy_glyph2_table (dest->glyphs2); dest->selectors = copy_selector_array (dest->selectors); dest->symbols = NULL; + dest->n_symbols = 0; dest->symbols2 = NULL; + dest->n_symbols2 = 0; dest->packed_bitmaps = NULL; dest->packed_bitmaps2 = NULL; dest->need_rebuild = TRUE; dest->refs = 1; + + if (!src->need_rebuild) + chafa_symbol_map_prepare (dest); } void