fix bug 2425. With the use of cgraph, the strings used in attributes are attached to
the root graph, so file name pointers being stored in the image cache are no longer
valid when the graph is deleted. The image cache needs to use the global string cache.
As this could lead to many unsed image cache items, we might consider limiting the cache
size, or starting afresh with each new graph.
usershape_t *gvusershape_find(char *name)
{
- usershape_t probe, *us;
+ usershape_t *us;
assert(name);
assert(name[0]);
if (!ImageDict)
return NULL;
- probe.name = name;
- us = dtsearch(ImageDict, &probe);
+ us = dtmatch(ImageDict, name);
return us;
}
if (! (us = zmalloc(sizeof(usershape_t))))
return NULL;
- us->name = name;
+ us->name = agstrdup (0, name);
if (!gvusershape_file_access(us))
return NULL;