]> granicus.if.org Git - graphviz/commitdiff
Flush image cache if the image path variable changes.
authorEmden Gansner <erg@research.att.com>
Tue, 6 Sep 2011 21:12:37 +0000 (17:12 -0400)
committerEmden Gansner <erg@research.att.com>
Tue, 6 Sep 2011 21:12:37 +0000 (17:12 -0400)
lib/gvc/gvusershape.c

index 4f112b6e6563086191340086164dc47178d8117f..f69f971d3ae0b48bb8c77cb11deb215acf2fd9c9 100644 (file)
@@ -28,7 +28,8 @@
 #include "utils.h"
 #include "gvplugin_loadimage.h"
 
-
+extern char *Gvimagepath;
+extern char *HTTPServerEnVar;
 extern shape_desc *find_user_shape(const char *);
 
 static Dict_t *ImageDict;
@@ -477,6 +478,7 @@ point gvusershape_size(graph_t * g, char *name)
 {
     point rv;
     pointf dpi;
+    static char* oldpath;
 
     /* no shape file, no shape size */
     if (!name || (*name == '\0')) {
@@ -484,6 +486,14 @@ point gvusershape_size(graph_t * g, char *name)
        return rv;
     }
 
+    if (!HTTPServerEnVar && strcmp(oldpath,Gvimagepath)) {
+       oldpath = Gvimagepath;
+       if (ImageDict) {
+           dtclose(ImageDict);
+           ImageDict = NULL;
+       }
+    }
+
     if ((dpi.y = GD_drawing(g)->dpi) >= 1.0)
        dpi.x = dpi.y;
     else