Index: trunk/src/hid_cam.c =================================================================== --- trunk/src/hid_cam.c (revision 23521) +++ trunk/src/hid_cam.c (revision 23522) @@ -434,6 +434,10 @@ int pcb_cam_end(pcb_cam_t *dst) { free(dst->inst); + if (dst->fn_template != NULL) { + free(dst->fn); + free(dst->fn_last); + } dst->inst = NULL; if (!dst->active) return -1; @@ -475,6 +479,13 @@ ctx.grp = pcb_get_layergrp(cam->pcb, gid); ctx.vl = vl; cam->fn = pcb_strdup_subst(cam->fn_template, cam_update_name_cb, &ctx, PCB_SUBST_HOME | PCB_SUBST_PERCENT | PCB_SUBST_CONF); + if ((cam->fn_last == NULL) || (strcmp(cam->fn, cam->fn_last) != 0)) { + cam->fn_changed = 1; + free(cam->fn_last); + cam->fn_last = pcb_strdup(cam->fn); + } + else + cam->fn_changed = 0; return 1; } Index: trunk/src/hid_cam.h =================================================================== --- trunk/src/hid_cam.h (revision 23521) +++ trunk/src/hid_cam.h (revision 23522) @@ -8,6 +8,7 @@ typedef struct pcb_cam_s { /* public */ char *fn; + pcb_bool fn_changed; /* true if last call changed the ->fn field */ pcb_bool active; int grp_vis[PCB_MAX_LAYERGRP]; /* whether a real layer group should be rendered */ int vgrp_vis[PCB_VLY_end]; /* whether a virtual layer group should be rendered */ @@ -19,6 +20,7 @@ /* private/internal/cache */ const char *fn_template; + char *fn_last; char *inst; pcb_board_t *pcb; int orig_vis[PCB_MAX_LAYER]; /* backup of the original layer visibility */