Changeset 372c4cd for molecuilder


Ignore:
Timestamp:
Oct 10, 2008, 1:38:46 PM (17 years ago)
Author:
Frederik Heber <heber@…>
Children:
1e5e16
Parents:
31ed7d
git-author:
Frederik Heber <heber@…> (10/10/08 13:36:06)
git-committer:
Frederik Heber <heber@…> (10/10/08 13:38:46)
Message:

BUGFIX: AssignKeySetsToFragment() had FragmentCounter-- at wrong place

+ MoleculeLeafClass::AssignKeySetsToFragment(): FragmentCounter was decreased even when no keyset had been scanned, setting it to -1, bad for the subsequent free. It has to be decreased again right after the recursive call. Begin and end messages added. Free checks for FreeList=true and ListOfLocalAtoms != NULL (safety measure).
+ MoleculeLeafClass::FillBondStructureFromReference(): No BUG here (no keyset check to prevent increase for subsequent decrease), but same changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/moleculelist.cpp

    r31ed7d r372c4cd  
    573573  int AtomNo;
    574574
     575  *out << Verbose(1) << "Begin of FillBondStructureFromReference." << endl;
    575576  // fill ListOfLocalAtoms if NULL was given
    576577  if (!FillListOfLocalAtoms(out, ListOfLocalAtoms, FragmentCounter, reference->AtomCount, FreeList)) {
     
    601602    if (next != NULL)
    602603      status = next->FillBondStructureFromReference(out, reference, FragmentCounter, ListOfLocalAtoms);
    603   }
    604  
    605   FragmentCounter--;
    606   if (FreeList) {
     604    FragmentCounter--;
     605  }
     606 
     607  if ((FreeList) && (ListOfLocalAtoms != NULL)) {
    607608    // free the index lookup list
    608609    Free((void **)&ListOfLocalAtoms[FragmentCounter], "MoleculeLeafClass::FillBondStructureFromReference - **ListOfLocalAtoms[]");
     
    611612  }
    612613  FragmentCounter--;
     614  *out << Verbose(1) << "End of FillBondStructureFromReference." << endl;
    613615  return status;
    614616};
     
    701703  int KeySetCounter = 0;
    702704 
     705  *out << Verbose(1) << "Begin of AssignKeySetsToFragment." << endl;
    703706  // fill ListOfLocalAtoms if NULL was given
    704707  if (!FillListOfLocalAtoms(out, ListOfLocalAtoms, FragmentCounter, reference->AtomCount, FreeList)) {
     
    740743    if (next != NULL)
    741744      next->AssignKeySetsToFragment(out, reference, KeySetList, ListOfLocalAtoms, FragmentList, FragmentCounter, FreeList);
     745    FragmentCounter--;
    742746  } else
    743747    *out << Verbose(1) << "KeySetList is NULL or empty." << endl;
    744748 
    745   FragmentCounter--;
    746   if (FreeList) {
     749  if ((FreeList) && (ListOfLocalAtoms != NULL)) {
    747750    // free the index lookup list
    748751    Free((void **)&ListOfLocalAtoms[FragmentCounter], "MoleculeLeafClass::AssignKeySetsToFragment - **ListOfLocalAtoms[]");
     
    750753      Free((void **)&ListOfLocalAtoms, "MoleculeLeafClass::AssignKeySetsToFragment - ***ListOfLocalAtoms");
    751754  }
     755  *out << Verbose(1) << "End of AssignKeySetsToFragment." << endl;
    752756  return status;
    753757};
Note: See TracChangeset for help on using the changeset viewer.