Changeset 14904
- Timestamp:
- Sep 20, 2007, 9:14:51 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20070830/psLib/src/imageops/psImageStructManip.c
r14523 r14904 8 8 * @author Robert DeSonia, MHPCC 9 9 * 10 * @version $Revision: 1.17 $ $Name: not supported by cvs2svn $11 * @date $Date: 2007-0 8-16 02:51:09$10 * @version $Revision: 1.17.2.1 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2007-09-20 19:14:51 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 23 23 24 24 #include "psMemory.h" 25 #include "psError.h" 26 #include "psAbort.h" 27 25 28 #include "psImageStructManip.h" 26 #include "psError.h"27 28 29 29 30 // col0,row0 are the starting pixel in the input image coordinate frame … … 98 99 if (out != NULL) { 99 100 // if a child, need to orphan (disassociate from parent) first 100 if (out->parent != NULL) { 101 psArrayRemoveData(out->parent->children,psMemIncrRefCounter(out)); 102 // remove from parent's knowledge without triggering a free 103 out->parent = NULL; // break link to parent 101 psImage *parent = (psImage *) out->parent; 102 if (parent != NULL) { 103 // break the back-pointer first so we don't loop 104 out->parent = NULL; 105 106 // drop my entry on my parent's array of children 107 psArrayRemoveDataNoFree (out->parent->children, out); 108 109 // drop my reference to my old parent 110 psFree (parent); 104 111 } 105 112 113 // we recycle out->data.V 106 114 psFree(out->p_rawDataBuffer); // free the previous data reference 107 115 } else { … … 117 125 P_PSIMAGE_SET_ROW0(out, row0); 118 126 119 out->parent = image;127 out->parent = psMemIncrRefCounter(image); // track references to parents 120 128 out->children = NULL; 121 129 out->p_rawDataBuffer = rawData; … … 133 141 134 142 // add output image as a child of the input image. 135 image->children = psArrayAdd (image->children,16,out);136 ps MemDecrRefCounter(out); // don't count the reference held by parent as a true reference143 image->children = psArrayAdd (image->children, 16, out); 144 psFree (out); // the image->children array is an array of views only 137 145 138 146 return (out); … … 307 315 _("Can not operate on a NULL psImage.")); 308 316 return NULL; 317 } 318 319 if ((image->children != NULL) && (image->children->n > 0)) { 320 psAbort ("cannot trim an image with outstanding children"); 309 321 } 310 322 … … 345 357 } 346 358 347 psImageFreeChildren(image);348 349 359 psU32 elementSize = PSELEMTYPE_SIZEOF(image->type.type); 350 360 psU32 numCols = col1-col0;
Note:
See TracChangeset
for help on using the changeset viewer.
