IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 23, 2007, 5:00:22 PM (19 years ago)
Author:
Paul Price
Message:

Was producing corruption of the bias list by freeing an image while
it was on the list, and then freeing the list.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/camera/pmHDUGenerate.c

    r9986 r11254  
    272272// Paste the source image into the target, according to the provided region.  The source is then updated to
    273273// reference the region within the target.
    274 static void pasteImage(psImage *target, // Target image, into which the paste is made
    275                        psImage **sourcePtr,// Source image, from which the paste is made, and then changed
    276                        psRegion *region // Image section into which to paste
    277                       )
    278 {
    279     psImage *source = *sourcePtr;       // Dereference pointer, for convenience
     274static psImage *pasteImage(psImage *target, // Target image, into which the paste is made
     275                           psImage *source,// Source image, from which the paste is made, and then changed
     276                           psRegion *region // Image section into which to paste
     277                          )
     278{
    280279    if (source->numCols != region->x1 - region->x0 || source->numRows != region->y1 - region->y0) {
    281280        psString regionString = psRegionToString(*region);
     
    287286
    288287    // Reference the HDU version, so that subsequent changes will touch the HDU
    289     psFree(source);
    290     *sourcePtr = psImageSubset(target, *region);
    291 
    292     return;
     288    return psImageSubset(target, *region);
    293289}
    294290
     
    404400
    405401                if (readout->image) {
    406                     pasteImage(hduImages->data[i], &readout->image, trimsec);
     402                    psImage *new = pasteImage(hduImages->data[i], readout->image, trimsec);
     403                    psFree(readout->image);
     404                    readout->image = new;
    407405                }
    408406                if (readout->mask) {
    409                     pasteImage(hduMasks->data[i], &readout->mask, trimsec);
     407                    psImage *new = pasteImage(hduMasks->data[i], readout->mask, trimsec);
     408                    psFree(readout->mask);
     409                    readout->mask = new;
    410410                }
    411411                if (readout->weight) {
    412                     pasteImage(hduWeights->data[i], &readout->weight, trimsec);
     412                    psImage *new = pasteImage(hduWeights->data[i], readout->weight, trimsec);
     413                    psFree(readout->weight);
     414                    readout->weight = new;
    413415                }
    414416
     
    424426                while ((bias = psListGetAndIncrement(biasIter)) &&
    425427                        (biassec = psListGetAndIncrement(biassecsIter))) {
    426                     pasteImage(hduImages->data[i], &bias, biassec);
    427                     psListAdd(newBias, PS_LIST_TAIL, bias);
     428                    psImage *new = pasteImage(hduImages->data[i], bias, biassec);
     429                    psListAdd(newBias, PS_LIST_TAIL, new);
    428430                }
    429431                psFree(biasIter);
Note: See TracChangeset for help on using the changeset viewer.