Changeset 1384 for trunk/src


Ignore:
Timestamp:
07/13/07 12:08:18 (17 years ago)
Author:
mar637
Message:

use CountedPtr to prevent potential leaks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STMath.cpp

    r1373 r1384  
    11751175  cols[3] = String("CYCLENO");
    11761176  TableIterator iter(tout, cols);
    1177   STPol* stpol = STPol::getPolClass(out->factories_, out->getPolType() );
     1177  CountedPtr<STPol> stpol = STPol::getPolClass(out->factories_,
     1178                                               out->getPolType() );
    11781179  while (!iter.pastEnd()) {
    11791180    Table t = iter.table();
     
    11811182    ScalarColumn<uInt> focidcol(t, "FOCUS_ID");
    11821183    ScalarColumn<Float> parancol(t, "PARANGLE");
    1183     Matrix<Float> pols = speccol.getColumn();
     1184    Matrix<Float> pols(speccol.getColumn());
    11841185    try {
    11851186      stpol->setSpectra(pols);
     
    11911192      // disable total feed angle to support paralactifying Caswell style
    11921193      stpol->setPhaseCorrections(parang, -parang, fhand);
    1193       (stpol->*fptr)(phase);
     1194      // use a member function pointer in STPol.  This only works on
     1195      // the STPol pointer itself, not the Counted Pointer so
     1196      // derefernce it.
     1197      (&(*(stpol))->*fptr)(phase);
    11941198      speccol.putColumn(stpol->getSpectra());
    1195       Matrix<Float> tmp = stpol->getSpectra();
    11961199    } catch (AipsError& e) {
    1197       delete stpol;stpol=0;
     1200      //delete stpol;stpol=0;
    11981201      throw(e);
    11991202    }
    12001203    ++iter;
    12011204  }
    1202   delete stpol;stpol=0;
     1205  //delete stpol;stpol=0;
    12031206  return out;
    12041207}
Note: See TracChangeset for help on using the changeset viewer.