/* * destroy a SWFMovie * This function destroys a SWFMovie and frees the memmory associated with it */ void destroySWFMovie(SWFMovie movie /* Movie to be destroyed */) { destroySWFBlockList(movie->blockList); destroySWFDisplayList(movie->displayList); destroySWFRect(movie->bounds); if ( movie->nExports > 0 ) destroySWFExports(movie); if ( movie->fonts != NULL ) free(movie->fonts); if (movie->imports) free(movie->imports); if(movie->fattrs) destroySWFFileAttributes(movie->fattrs); if(movie->limits) destroySWFScriptLimits(movie->limits); if(movie->backgroundBlock) destroySWFBlock(movie->backgroundBlock); #if TRACK_ALLOCS ming_gc_remove_node(movie->gcnode); #endif free(movie); }
SWFText newSWFText() { SWFRect temp_rect; SWFText text = (SWFText)malloc(sizeof(struct SWFText_s)); /* If malloc failed, return NULL to signify this */ if (NULL == text) return NULL; SWFCharacterInit((SWFCharacter)text); CHARACTERID(text) = ++SWF_gNumCharacters; BLOCK(text)->type = SWF_DEFINETEXT; BLOCK(text)->writeBlock = writeSWFTextToMethod; BLOCK(text)->complete = completeSWFText; BLOCK(text)->dtor = (destroySWFBlockMethod) destroySWFText; temp_rect = newSWFRect(0,0,0,0); /* If newSWFRect() failed, return NULL to signify this */ if (NULL == temp_rect) { free(text); return NULL; } CHARACTER(text)->bounds = temp_rect; text->out = newSWFOutput(); /* If newSWFOutput() failed, return NULL to signify this */ if (NULL == text->out) { destroySWFRect(temp_rect); free(text); return NULL; } text->currentRecord = NULL; text->initialRecord = NULL; text->matrix = NULL; text->nAdvanceBits = 0; #if TRACK_ALLOCS text->gcnode = ming_gc_add_node(text, (dtorfunctype) destroySWFBitmap); #endif return text; }
void destroySWFCharacter(SWFCharacter character) { if ( character->dependencies != NULL ) free(character->dependencies); if ( character->bounds != NULL ) destroySWFRect(character->bounds); // destroySWFBlock((SWFBlock)character); free(character); }