Skip to content

Commit 6da72bb

Browse files
committed
Fix inverted order of unloading streaming ANI files.
When streaming an ANI file, first anim_load() is called, then init_anim_instance(). The latter increments the animation's instance_count. If anim_free() is called on an animation that still has instances, it refuses to free the animation. generic_anim_unload() first called anim_free(), then free_anim_instance(). The fact that ANI files would ever unload at all seems to be because some code would unload twice. I can only assume that, combined with the fact that the bug only applies to ANI files, explains how this bug went undetected since November of 2009 (commit b434178 seems to be when it was added, from a quick glance at git blame).
1 parent c7fbefe commit 6da72bb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

code/graphics/generic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,8 @@ void generic_anim_unload(generic_anim *ga)
323323
if(ga->num_frames > 0) {
324324
if(ga->streaming) {
325325
if(ga->type == BM_TYPE_ANI) {
326-
anim_free(ga->ani.animation);
327326
free_anim_instance(ga->ani.instance);
327+
anim_free(ga->ani.animation);
328328
}
329329
if(ga->type == BM_TYPE_EFF) {
330330
if(ga->eff.next_frame >= 0)

0 commit comments

Comments
 (0)