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:
@@ -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_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user