Changeset 1920 for trunk/psLib/src/image/psImage.c
- Timestamp:
- Sep 28, 2004, 1:26:49 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/image/psImage.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/image/psImage.c
r1897 r1920 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.4 6$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-09-2 5 02:06:12$12 * @version $Revision: 1.47 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-09-28 23:26:48 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 68 68 *(psElemType* ) & image->type.type = type; 69 69 image->parent = NULL; 70 image->nChildren = 0;71 70 image->children = NULL; 72 71 … … 81 80 82 81 if (image->type.type == PS_TYPE_PTR) { 83 // 2-D array of pointers -- must 84 // dereference 82 // 2-D array of pointers -- must dereference elements 85 83 unsigned int oldNumRows = image->numRows; 86 84 unsigned int oldNumCols = image->numCols; … … 95 93 } 96 94 95 if (image->parent != NULL) { 96 psArrayRemove(image->parent->children,image); 97 image->parent = NULL; 98 } 99 97 100 psImageFreeChildren(image); 98 101 99 102 psFree(image->rawDataBuffer); 100 103 psFree(image->data.V); 101 image->data.V = NULL;102 104 } 103 105 … … 164 166 int psImageFreeChildren(psImage* image) 165 167 { 166 int i = 0;167 int nChildren = 0;168 psImage* *children = NULL;169 168 int numFreed = 0; 170 169 … … 173 172 } 174 173 175 nChildren = image->nChildren; 176 children = image->children; 177 178 for (i = 0; i < nChildren; i++) { 179 if (children[i] != NULL) { 180 numFreed++; 181 psFree(children[i]); 174 if (image->children != NULL) { 175 psImage** children = (psImage**)image->children->data; 176 numFreed = image->children->n; 177 178 // orphan the children first 179 // (so psFree doesn't try to modify the parent's children array while I'm using it) 180 for (int i=0;i<numFreed;i++) { 181 children[i]->parent = NULL; 182 182 } 183 } 184 psFree(children); 185 186 image->nChildren = 0; 187 image->children = NULL; 183 184 psFree(image->children); 185 image->children = NULL; 186 } 188 187 189 188 return numFreed;
Note:
See TracChangeset
for help on using the changeset viewer.
