From 6e413bfdd257393d3881901364c08a657c3f2b34 Mon Sep 17 00:00:00 2001 From: Emden Gansner Date: Tue, 6 Sep 2011 17:12:37 -0400 Subject: [PATCH] Flush image cache if the image path variable changes. --- lib/gvc/gvusershape.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/gvc/gvusershape.c b/lib/gvc/gvusershape.c index 4f112b6e6..f69f971d3 100644 --- a/lib/gvc/gvusershape.c +++ b/lib/gvc/gvusershape.c @@ -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 -- 2.40.0