Changeset 70caa3


Ignore:
Timestamp:
Jun 20, 2018, 8:20:43 AM (7 years ago)
Author:
Frederik Heber <frederik.heber@…>
Branches:
AutomationFragmentation_failures, Candidate_v1.6.1, ChemicalSpaceEvaluator, Exclude_Hydrogens_annealWithBondGraph, ForceAnnealing_with_BondGraph_contraction-expansion, StoppableMakroAction
Children:
883d98, a6c11a
Parents:
4b2adf
git-author:
Frederik Heber <frederik.heber@…> (09/15/17 08:21:12)
git-committer:
Frederik Heber <frederik.heber@…> (06/20/18 08:20:43)
Message:

FIX: FormatParserStorage would open new streams per SaveAll().

  • we did not check whether an open stream was still present and always opened a new one: OutputAction would cause an "too many open files" at some point because all those streams (on the same filename) were never closed.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/FormatParserStorage.cpp

    r4b2adf r70caa3  
    201201{
    202202  std::string filename;
    203   for (ParserTypes iter = ParserTypes_begin; iter < ParserTypes_end; ++iter)
     203  for (ParserTypes iter = ParserTypes_begin; iter < ParserTypes_end; ++iter) {
     204    // open a new stream, if parser is desired. Reopen such stream if already present
    204205    if (ParserPresent[iter] && ParserDesiredOutputFormat[iter]) {
     206      if (ParserStream[iter] != NULL) {
     207        if (ParserStream[iter]->is_open()) {
     208          ParserStream[iter]->flush();
     209          ParserStream[iter]->close();
     210        }
     211        delete ParserStream[iter];
     212        ParserStream[iter] = NULL;
     213        ParserList[iter]->setOstream(ParserStream[iter]);
     214      }
    205215      filename = prefix;
    206216      filename += ".";
     
    209219      ParserList[iter]->setOstream((std::ostream *)ParserStream[iter]);
    210220    }
     221  }
    211222}
    212223
Note: See TracChangeset for help on using the changeset viewer.