[cig-commits] commit: making the variable destroy it's subComponent vars

Mercurial hg at geodynamics.org
Mon Feb 1 15:32:59 PST 2010


changeset:   736:56ba154d2aa2
branch:      pcu_rejig
parent:      732:31a90adec0ec
user:        JulianGiordani
date:        Mon Dec 14 15:03:15 2009 +1100
files:       Base/Context/src/Variable.c
description:
making the variable destroy it's subComponent vars


diff -r 31a90adec0ec -r 56ba154d2aa2 Base/Context/src/Variable.c
--- a/Base/Context/src/Variable.c	Fri Dec 11 17:48:49 2009 +1100
+++ b/Base/Context/src/Variable.c	Mon Dec 14 15:03:15 2009 +1100
@@ -533,6 +533,7 @@ void* _Variable_Copy( void* variable, vo
 	newVariable->arraySizeFunc = self->arraySizeFunc;
 	
 	newVariable->allocateSelf = self->allocateSelf; /* This may change depending on whether arrayPtr is found in map */
+	newVariable->subVariablesCount = self->subVariablesCount;
 
 	/* single valued members */
 	
@@ -934,11 +935,16 @@ void _Variable_AssignFromXML( void* vari
 	
 void _Variable_Destroy( void* variable, void* data ) {
 	Variable* self = (Variable*)variable;
+   int ii;
+
+   for( ii = 0 ; ii < self->subVariablesCount ; ii++ ) {
+      Stg_Component_Destroy( self->components[ii], data, False );
+   }
 	
 	if ( self->dataSizes ) {
 		Memory_Free( self->dataSizes );
 	}
-	if (self->allocateSelf) {
+	if (self->allocateSelf && self->arraySize != 0) {
 		Memory_Free( self->arrayPtr );
 	}
 	



More information about the CIG-COMMITS mailing list