new tags are now mapped to their own IDs, not an allocated one
[swftools.git] / lib / python / taglist.c
index 9caf3b2..e4eeffc 100644 (file)
@@ -41,10 +41,15 @@ PyObject * taglist_new2(TAG*tag)
     nr = 0;
     t = tag;
     while(t) {
-       PyObject*newtag = tag_new2(tag, taglist->tagmap);
+       PyObject*newtag = tag_new2(t, taglist->tagmap);
+       if(newtag==NULL) {
+           // pass through exception
+           return NULL;
+       }
        PyList_SET_ITEM(taglist->taglist,nr,newtag);Py_INCREF(newtag);
        if(swf_isDefiningTag(t)) {
-           tagmap_add(taglist->tagmap, newtag);
+           int id = swf_GetDefineID(t);
+           tagmap_addMapping(taglist->tagmap, id, newtag);
        }
        nr++;
        t=t->next;
@@ -72,6 +77,7 @@ TAG* taglist_getTAGs(PyObject*self)
        tag = tag_getTAG(item, tag, taglist->tagmap);
        if(!firstTag)
            firstTag = tag;
+       mylog(" %08x(%d) taglist_getTAGs: added tag %08x", (int)self, self->ob_refcnt, tag);
     }
     return firstTag;
 }