1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-04-21 02:17:08 +00:00

Ensures lifetime-linked track flushing without relying on virtual calls within a destructor.

This commit is contained in:
Thomas Harte
2017-10-07 19:14:18 -04:00
parent 53b99ea248
commit b37787a414
3 changed files with 7 additions and 3 deletions
+5
View File
@@ -21,7 +21,12 @@ Drive::Drive(unsigned int input_clock_rate, int revolutions_per_minute, int numb
available_heads_(number_of_heads) {
}
Drive::~Drive() {
if(disk_) disk_->flush_tracks();
}
void Drive::set_disk(const std::shared_ptr<Disk> &disk) {
if(disk_) disk_->flush_tracks();
disk_ = disk;
has_disk_ = !!disk_;