From e5b25fd30a6bf083ae321301afd72cce85c95e33 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Sun, 29 Nov 2009 19:32:30 +0100 Subject: [PATCH] unconditionally call load_fonts() Since load_fonts() iterates over font_count fonts which is initially -1, it turns into a NOP when no fonts where added. --- src/conky.c | 8 +------- src/fonts.c | 11 ++++------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/conky.c b/src/conky.c index 81ecda60..b9d032bf 100644 --- a/src/conky.c +++ b/src/conky.c @@ -710,9 +710,6 @@ void generate_text_internal(char *p, int p_max_size, struct text_object root, struct information *cur) { struct text_object *obj; -#ifdef X11 - int need_to_load_fonts = 0; -#endif /* X11 */ /* for the OBJ_top* handler */ struct process **needed = 0; @@ -795,7 +792,6 @@ void generate_text_internal(char *p, int p_max_size, #ifdef X11 OBJ(font) { new_font(p, obj->data.s); - need_to_load_fonts = 1; } #endif /* X11 */ OBJ(text) { @@ -836,9 +832,7 @@ obj_loop_tail: } #ifdef X11 /* load any new fonts we may have had */ - if (need_to_load_fonts) { - load_fonts(); - } + load_fonts(); #endif /* X11 */ } diff --git a/src/fonts.c b/src/fonts.c index b110d109..2f133d47 100644 --- a/src/fonts.c +++ b/src/fonts.c @@ -128,10 +128,6 @@ void free_fonts(void) if ((output_methods & TO_X) == 0) { return; } - if(fontloaded == 0) { - free(fonts); - return; - } for (i = 0; i <= font_count; i++) { #ifdef XFT if (use_xft) { @@ -144,8 +140,10 @@ void free_fonts(void) fonts[i].font = 0; } } - free(fonts); - fonts = 0; + if (fonts) { + free(fonts); + fonts = 0; + } font_count = -1; selected_font = 0; #ifdef XFT @@ -198,5 +196,4 @@ void load_fonts(void) } } } - fontloaded = 1; }