diff --git a/Storage/Disk/PCMPatchedTrack.cpp b/Storage/Disk/PCMPatchedTrack.cpp index 0900a3d8a..0d1502f3d 100644 --- a/Storage/Disk/PCMPatchedTrack.cpp +++ b/Storage/Disk/PCMPatchedTrack.cpp @@ -22,11 +22,11 @@ PCMPatchedTrack::PCMPatchedTrack(std::shared_ptr underlying_track) : void PCMPatchedTrack::add_segment(const Time &start_time, const PCMSegment &segment) { - event_sources_.emplace_back(segment); + std::shared_ptr event_source(new PCMSegmentEventSource(segment)); Time zero(0); - Time end_time = start_time + event_sources_.back().get_length(); - Period insertion_period(start_time, end_time, zero, &event_sources_.back()); + Time end_time = start_time + event_source->get_length(); + Period insertion_period(start_time, end_time, zero, event_source); // the new segment may wrap around, so divide it up into track-length parts if required Time one = Time(1); diff --git a/Storage/Disk/PCMPatchedTrack.hpp b/Storage/Disk/PCMPatchedTrack.hpp index 31523347e..d18b88e0b 100644 --- a/Storage/Disk/PCMPatchedTrack.hpp +++ b/Storage/Disk/PCMPatchedTrack.hpp @@ -38,14 +38,13 @@ class PCMPatchedTrack: public Track { private: std::shared_ptr underlying_track_; - std::vector event_sources_; struct Period { Time start_time, end_time; Time segment_start_time; - PCMSegmentEventSource *event_source; // nullptr => use the underlying track + std::shared_ptr event_source; // nullptr => use the underlying track - Period(const Time &start_time, const Time &end_time, const Time &segment_start_time, PCMSegmentEventSource *event_source) : + Period(const Time &start_time, const Time &end_time, const Time &segment_start_time, std::shared_ptr event_source) : start_time(start_time), end_time(end_time), segment_start_time(segment_start_time), event_source(event_source) {} }; std::vector periods_;