/[svn]/libgig/trunk/src/gig.cpp
ViewVC logotype

Diff of /libgig/trunk/src/gig.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3970 by schoenebeck, Thu Jun 24 11:49:31 2021 UTC revision 3974 by schoenebeck, Fri Jul 16 16:53:13 2021 UTC
# Line 6389  namespace { Line 6389  namespace {
6389         wave->AddSubChunk(CHUNK_ID_FMT, 16);         wave->AddSubChunk(CHUNK_ID_FMT, 16);
6390         wave->AddSubList(LIST_TYPE_INFO);         wave->AddSubList(LIST_TYPE_INFO);
6391    
6392           const size_t idxIt = SamplesIterator - pSamples->begin();
6393         pSamples->push_back(pSample);         pSamples->push_back(pSample);
6394           SamplesIterator = pSamples->begin() + std::min(idxIt, pSamples->size()); // avoid iterator invalidation
6395         return pSample;         return pSample;
6396      }      }
6397    
# Line 6406  namespace { Line 6408  namespace {
6408          if (!pSamples || !pSamples->size()) throw gig::Exception("Could not delete sample as there are no samples");          if (!pSamples || !pSamples->size()) throw gig::Exception("Could not delete sample as there are no samples");
6409          SampleList::iterator iter = find(pSamples->begin(), pSamples->end(), (DLS::Sample*) pSample);          SampleList::iterator iter = find(pSamples->begin(), pSamples->end(), (DLS::Sample*) pSample);
6410          if (iter == pSamples->end()) throw gig::Exception("Could not delete sample, could not find given sample");          if (iter == pSamples->end()) throw gig::Exception("Could not delete sample, could not find given sample");
6411          if (SamplesIterator != pSamples->end() && *SamplesIterator == pSample) ++SamplesIterator; // avoid iterator invalidation          const size_t idxIt = SamplesIterator - pSamples->begin();
6412          pSamples->erase(iter);          pSamples->erase(iter);
6413            SamplesIterator = pSamples->begin() + std::min(idxIt, pSamples->size()); // avoid iterator invalidation
6414          pSample->DeleteChunks();          pSample->DeleteChunks();
6415          delete pSample;          delete pSample;
6416    

Legend:
Removed from v.3970  
changed lines
  Added in v.3974

  ViewVC Help
Powered by ViewVC