[gegl] gegl-init: fix the "swapping to ram" fallback when GEGL_SWAP environment variable is set.



commit 668fa60b33eff5a73fe1af1e935a1112bf295dc2
Author: Jehan <jehan girinstud io>
Date:   Thu Dec 20 02:31:00 2012 +0900

    gegl-init: fix the "swapping to ram" fallback when GEGL_SWAP environment variable is set.
    
    In such a case, the NULL `swap` variable was overwritten afterwards
    even though it was already tested that the directory could not be
    created; hence GEGL would soon crash with a IO error.
    Makes the code consistently use gegl_swap_dir () which has the right
    value.
    
    Additionally when the swap directory cannot be created, free the string
    before setting it to NULL.

 gegl/gegl-init.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/gegl/gegl-init.c b/gegl/gegl-init.c
index aa1f63c..68d7149 100644
--- a/gegl/gegl-init.c
+++ b/gegl/gegl-init.c
@@ -132,6 +132,7 @@ gegl_swap_dir (void)
           g_free (name);
 #endif
 
+          g_free (swapdir);
           swapdir = NULL;
         }
     }
@@ -577,7 +578,7 @@ gegl_post_parse_hook (GOptionContext *context,
   gegl_instrument ("gegl", "gegl_init", gegl_ticks () - global_time);
 
   if (g_getenv ("GEGL_SWAP"))
-    g_object_set (config, "swap", g_getenv ("GEGL_SWAP"), NULL);
+    g_object_set (config, "swap", gegl_swap_dir (), NULL);
   if (g_getenv ("GEGL_QUALITY"))
     {
       const gchar *quality = g_getenv ("GEGL_QUALITY");



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]