Add include of cairo.h when using librsvg
[dana/openbox.git] / obrender / image.c
index 0164a8c..cffbaf3 100644 (file)
@@ -25,6 +25,7 @@
 #include <Imlib2.h>
 #endif
 #ifdef USE_LIBRSVG
+#include <cairo.h>
 #include <librsvg/rsvg.h>
 #endif
 
@@ -243,7 +244,7 @@ RrImageSet* RrImageSetMergeSets(RrImageSet *b, RrImageSet *a)
     gint n_original, n_resized, tmp;
     GSList *it;
 
-    const gint max_resized = a->cache->max_resized_saved;
+    gint max_resized;
 
     if (!a)
         return b;
@@ -251,7 +252,6 @@ RrImageSet* RrImageSetMergeSets(RrImageSet *b, RrImageSet *a)
         return a;
     if (a == b)
         return b;
-
     /* the original and resized picture lists in an RrImageSet are kept ordered
        as newest to oldest.  we don't have timestamps for them, so we cannot
        preserve this in the merged RrImageSet exactly.  a decent approximation,
@@ -264,6 +264,8 @@ RrImageSet* RrImageSetMergeSets(RrImageSet *b, RrImageSet *a)
 
     g_assert(b->cache == a->cache);
 
+    max_resized = a->cache->max_resized_saved;
+
     a_i = b_i = merged_i = 0;
     n_original = a->n_original + b->n_original;
     original = g_new(RrImagePic*, n_original);
@@ -652,10 +654,9 @@ RrImage* RrImageNewFromName(RrImageCache *cache, const gchar *name)
     }
 #endif
 
-    g_free(path);
-
     if (!loaded) {
         g_message("Cannot load image \"%s\" from file \"%s\"", name, path);
+        g_free(path);
 #if defined(USE_LIBRSVG)
         DestroyRsvgLoader(rsvg_loader);
 #endif
@@ -665,6 +666,8 @@ RrImage* RrImageNewFromName(RrImageCache *cache, const gchar *name)
         return NULL;
     }
 
+    g_free(path);
+
     /* get an RrImage that contains an RrImageSet with this picture in it.
        the RrImage might be new, or reused if the picture was already in the
        cache.