X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fdevices%2Frecord.c;h=a8a0088672b5ea848c97cc726d857c3204b00077;hb=bf04757cd94e94c1f67fa3d2a4e3e59fa5bce0c0;hp=a4b085962c343ef818392af448dc412cafa96462;hpb=31b87e3aaa53ef8b5ce37b2b3848f94da24c2486;p=swftools.git diff --git a/lib/devices/record.c b/lib/devices/record.c index a4b0859..a8a0088 100644 --- a/lib/devices/record.c +++ b/lib/devices/record.c @@ -348,7 +348,7 @@ static void record_fillgradient(struct _gfxdevice*dev, gfxline_t*line, gfxgradie static void record_addfont(struct _gfxdevice*dev, gfxfont_t*font) { internal_t*i = (internal_t*)dev->internal; - msg(" record: %08x ADDFONT %s\n", dev); + msg(" record: %08x ADDFONT %s\n", dev, font->id); if(font && !gfxfontlist_hasfont(i->fontlist, font)) { writer_writeU8(&i->w, OP_ADDFONT); dumpFont(&i->w, font); @@ -415,17 +415,7 @@ static void replay(struct _gfxdevice*dev, gfxdevice_t*out, void*data, int length unsigned char op = reader_readU8(r); switch(op) { case OP_END: - r->dealloc(r); - - { - gfxfontlist_t*l = fontlist; - while(l) { - l = l->next; - } - } - - gfxfontlist_free(fontlist, 1); - return; + goto finish; case OP_SETPARAM: { msg(" replay: SETPARAM"); char*key; @@ -557,7 +547,13 @@ static void replay(struct _gfxdevice*dev, gfxdevice_t*out, void*data, int length } } } - msg(" No END token in gfx recording"); +finish: + r->dealloc(r); + /* problem: if we just replayed into a device which stores the + font for later use (the record device itself is a nice example), + then we can't free it yet */ + //gfxfontlist_free(fontlist, 1); + gfxfontlist_free(fontlist, 0); } void gfxresult_record_replay(gfxresult_t*result, gfxdevice_t*device) {