1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-25 18:30:21 +00:00

Merge pull request #270 from TomHarte/TrackCloning

Corrects `insert` explicitly to supply a `shared_ptr` rather than a raw one.
This commit is contained in:
Thomas Harte 2017-11-11 18:23:49 -05:00 committed by GitHub
commit 3550196bed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,7 +25,7 @@ template <typename T> void DiskImageHolder<T>::flush_tracks() {
using TrackMap = std::map<Track::Address, std::shared_ptr<Track>>; using TrackMap = std::map<Track::Address, std::shared_ptr<Track>>;
std::shared_ptr<TrackMap> track_copies(new TrackMap); std::shared_ptr<TrackMap> track_copies(new TrackMap);
for(auto &address : unwritten_tracks_) { for(auto &address : unwritten_tracks_) {
track_copies->insert(std::make_pair(address, cached_tracks_[address]->clone())); track_copies->insert(std::make_pair(address, std::shared_ptr<Track>(cached_tracks_[address]->clone())));
} }
unwritten_tracks_.clear(); unwritten_tracks_.clear();