Index: read.c =================================================================== --- read.c (revision 31172) +++ read.c (revision 31173) @@ -919,6 +919,7 @@ } pcb_gfx_set_pixmap_dup(gfx, pxm, 0); + gfx->pxm_id = refid; pcb_gfx_update(gfx); if (ly != NULL) Index: write.c =================================================================== --- write.c (revision 31172) +++ write.c (revision 31173) @@ -533,7 +533,8 @@ if (existing == gfx->pxm_neutral) return gfx->pxm_id; - gfx->pxm_id = pcb_create_ID_get(); + if (existing != NULL) + gfx->pxm_id = pcb_create_ID_get(); /* need to find a new ID because the one in gfx is already in use for a different pixmap */ htip_set(&id2pxm, gfx->pxm_id, gfx->pxm_neutral); htpi_set(&pxm2id, gfx->pxm_neutral, gfx->pxm_id); return gfx->pxm_id;