1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-23 14:42:29 +01:00

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 <chris@computersalat.de> for reporting this.
This commit is contained in:
Carlos R. Mafra
2012-02-18 00:10:48 +00:00
parent 0173fe896d
commit a568686b39

View File

@@ -144,17 +144,9 @@ WMFont *WMCreateFont(WMScreen * scrPtr, char *fontName)
font->font = XftFontOpenName(display, scrPtr->screen, fname); font->font = XftFontOpenName(display, scrPtr->screen, fname);
if (!font->font) { if (!font->font) {
printf("Font named %s doesn't exist.\n", fname); wfree(font);
printf("Please check your system configuration.\n"); wfree(fname);
printf("Will try default font %s.\n", DEFAULT_FONT); return NULL;
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");
} }
font->height = font->font->ascent + font->font->descent; font->height = font->font->ascent + font->font->descent;