/[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 3978 by schoenebeck, Mon Jul 19 14:31:43 2021 UTC revision 3979 by schoenebeck, Mon Jul 19 14:43:22 2021 UTC
# Line 6659  namespace { Line 6659  namespace {
6659         // this string is needed for the gig to be loadable in GSt:         // this string is needed for the gig to be loadable in GSt:
6660         pInstrument->pInfo->Software = "Endless Wave";         pInstrument->pInfo->Software = "Endless Wave";
6661    
6662           const size_t idxIt = InstrumentsIterator - pInstruments->begin();
6663         pInstruments->push_back(pInstrument);         pInstruments->push_back(pInstrument);
6664           InstrumentsIterator = pInstruments->begin() + std::min(idxIt, pInstruments->size()); // avoid iterator invalidation
6665         return pInstrument;         return pInstrument;
6666      }      }
6667            
# Line 6771  namespace { Line 6773  namespace {
6773          if (!pInstruments) throw gig::Exception("Could not delete instrument as there are no instruments");          if (!pInstruments) throw gig::Exception("Could not delete instrument as there are no instruments");
6774          InstrumentList::iterator iter = find(pInstruments->begin(), pInstruments->end(), (DLS::Instrument*) pInstrument);          InstrumentList::iterator iter = find(pInstruments->begin(), pInstruments->end(), (DLS::Instrument*) pInstrument);
6775          if (iter == pInstruments->end()) throw gig::Exception("Could not delete instrument, could not find given instrument");          if (iter == pInstruments->end()) throw gig::Exception("Could not delete instrument, could not find given instrument");
6776            const size_t idxIt = InstrumentsIterator - pInstruments->begin();
6777          pInstruments->erase(iter);          pInstruments->erase(iter);
6778            InstrumentsIterator = pInstruments->begin() + std::min(idxIt, pInstruments->size()); // avoid iterator invalidation
6779          pInstrument->DeleteChunks();          pInstrument->DeleteChunks();
6780          delete pInstrument;          delete pInstrument;
6781      }      }

Legend:
Removed from v.3978  
changed lines
  Added in v.3979

  ViewVC Help
Powered by ViewVC