From a568686b39a1f7a5745afbf4d53378a489ee2d73 Mon Sep 17 00:00:00 2001 From: "Carlos R. Mafra" Date: Sat, 18 Feb 2012 00:10:48 +0000 Subject: [PATCH] WINGs: Do not call exit() WMCreateFont() was calling exit() if it could not create the font, and was trying too hard not to return NULL. Just return NULL if the font could not be created instead of exit()ing and let callers decide what to do upon failure. Thanks to Christian for reporting this. --- WINGs/wfont.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/WINGs/wfont.c b/WINGs/wfont.c index 245cdccd..62dd7d34 100644 --- a/WINGs/wfont.c +++ b/WINGs/wfont.c @@ -144,17 +144,9 @@ WMFont *WMCreateFont(WMScreen * scrPtr, char *fontName) font->font = XftFontOpenName(display, scrPtr->screen, fname); if (!font->font) { - printf("Font named %s doesn't exist.\n", fname); - printf("Please check your system configuration.\n"); - printf("Will try default font %s.\n", DEFAULT_FONT); - font->font = XftFontOpenName(display, scrPtr->screen, DEFAULT_FONT); - if (!font->font) { - printf("Unrecoverable font error! I must die!\n"); - wfree(font); - wfree(fname); - exit(1); - } else - printf("Default font loading succeded.\n"); + wfree(font); + wfree(fname); + return NULL; } font->height = font->font->ascent + font->font->descent;