]> Dogcows Code - chaz/openbox/commitdiff
don't exit in the render lib, rather return a NULL font/theme on failure
authorDana Jansens <danakj@orodu.net>
Sat, 21 Jun 2003 05:35:05 +0000 (05:35 +0000)
committerDana Jansens <danakj@orodu.net>
Sat, 21 Jun 2003 05:35:05 +0000 (05:35 +0000)
render/font.c
render/theme.c

index 592ced6fe39b1752d323afbe875c25d222474f37..b9a17b48786c744d62e5a7bcec372288e1660bd5 100644 (file)
@@ -23,7 +23,7 @@ static void font_startup(void)
 #endif /* DEBUG */
     if (!XftInit(0)) {
         g_warning(_("Couldn't initialize Xft.\n"));
-        exit(3);
+        exit(EXIT_FAILURE);
     }
 #ifdef DEBUG
     version = XftGetVersion();
@@ -71,9 +71,8 @@ RrFont *RrFontOpen(const RrInstance *inst, char *fontstring)
         return out;
     }
     g_warning(_("Unable to load font: %s\n"), "sans");
-    g_warning(_("Aborting!.\n"));
 
-    exit(3); /* can't continue without a font */
+    return NULL;
 }
 
 void RrFontClose(RrFont *f)
index 1a38093a3c888d3de9758fed1a993e41294e9054..7e45b86fe4aed1198a93a7ef46c17d018140167c 100644 (file)
@@ -27,7 +27,7 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name)
     gchar *font_str;
     RrTheme *theme;
 
-    theme = g_new(RrTheme, 1);
+    theme = g_new0(RrTheme, 1);
 
     theme->inst = inst;
 
@@ -125,7 +125,10 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name)
         theme->winfont_shadow_tint < 100 || theme->winfont_shadow_tint > 100)
         theme->winfont_shadow_tint = 25;
 
-    theme->winfont = RrFontOpen(inst, font_str);
+    if (!(theme->winfont = RrFontOpen(inst, font_str))) {
+        RrThemeFree(theme);
+        return NULL;
+    }
     theme->winfont_height = RrFontHeight(theme->winfont, theme->winfont_shadow,
                                          theme->winfont_shadow_offset);
 
@@ -156,7 +159,10 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name)
         theme->mtitlefont_shadow_tint > 100)
         theme->mtitlefont_shadow_tint = 25;
 
-    theme->mtitlefont = RrFontOpen(inst, font_str);
+    if (!(theme->mtitlefont = RrFontOpen(inst, font_str))) {
+        RrThemeFree(theme);
+        return NULL;
+    }
     theme->mtitlefont_height = RrFontHeight(theme->mtitlefont,
                                             theme->mtitlefont_shadow,
                                             theme->mtitlefont_shadow_offset);
@@ -188,7 +194,10 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name)
         theme->mfont_shadow_tint > 100)
         theme->mfont_shadow_tint = 25;
 
-    theme->mfont = RrFontOpen(inst, font_str);
+    if (!(theme->mfont = RrFontOpen(inst, font_str))) {
+        RrThemeFree(theme);
+        return NULL;
+    }
     theme->mfont_height = RrFontHeight(theme->mfont, theme->mfont_shadow,
                                        theme->mfont_shadow_offset);
 
This page took 0.02797 seconds and 4 git commands to generate.