goat3d

changeset 56:ca549434dc95

fixed a crashing bug in anm_destroy_node introduced when I added the multiple animations per node
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 23 Jan 2014 02:50:54 +0200
parents af1310ed212b
children 76d0f55f9d5f
files Makefile converters/ass2goat/src/main.c libs/anim/anim.c src/node.cc
diffstat 4 files changed, 13 insertions(+), 3 deletions(-) [+]
line diff
     1.1 --- a/Makefile	Sun Jan 19 14:56:44 2014 +0200
     1.2 +++ b/Makefile	Thu Jan 23 02:50:54 2014 +0200
     1.3 @@ -73,6 +73,13 @@
     1.4  clean:
     1.5  	rm -f $(obj) $(lib_a) $(lib_so)
     1.6  
     1.7 +.PHONY: cleanlibs
     1.8 +cleanlibs:
     1.9 +	$(MAKE) -C libs/openctm clean
    1.10 +	$(MAKE) -C libs/tinyxml2 clean
    1.11 +	$(MAKE) -C libs/vmath clean
    1.12 +	$(MAKE) -C libs/anim clean
    1.13 +
    1.14  .PHONY: cleandep
    1.15  cleandep:
    1.16  	rm -f $(dep)
     2.1 --- a/converters/ass2goat/src/main.c	Sun Jan 19 14:56:44 2014 +0200
     2.2 +++ b/converters/ass2goat/src/main.c	Thu Jan 23 02:50:54 2014 +0200
     2.3 @@ -288,7 +288,7 @@
     2.4  
     2.5  	lastdot = strrchr(fname, '.');
     2.6  
     2.7 -	fname_end = lastdot ? lastdot + 1 : fname + strlen(fname);
     2.8 +	fname_end = lastdot ? lastdot : fname + strlen(fname);
     2.9  	namesz = fname_end - fname;
    2.10  	reqsz = namesz + strlen(suffix) + 2;	/* plus 1 for the dot */
    2.11  
     3.1 --- a/libs/anim/anim.c	Sun Jan 19 14:56:44 2014 +0200
     3.2 +++ b/libs/anim/anim.c	Thu Jan 23 02:50:54 2014 +0200
     3.3 @@ -75,10 +75,11 @@
     3.4  
     3.5  void anm_destroy_node(struct anm_node *node)
     3.6  {
     3.7 -	int i;
     3.8 +	int i, num_anim;
     3.9  	free(node->name);
    3.10  
    3.11 -	for(i=0; i<ANM_NUM_TRACKS; i++) {
    3.12 +	num_anim = anm_get_animation_count(node);
    3.13 +	for(i=0; i<num_anim; i++) {
    3.14  		anm_destroy_animation(node->animations + i);
    3.15  	}
    3.16  	dynarr_free(node->animations);
     4.1 --- a/src/node.cc	Sun Jan 19 14:56:44 2014 +0200
     4.2 +++ b/src/node.cc	Thu Jan 23 02:50:54 2014 +0200
     4.3 @@ -26,6 +26,8 @@
     4.4  
     4.5  void g3dimpl::delete_node_tree(Node *n)
     4.6  {
     4.7 +	if(!n) return;
     4.8 +
     4.9  	for(int i=0; i<n->get_children_count(); i++) {
    4.10  		delete_node_tree((Node*)n->get_child(i));
    4.11  	}