Ensure that AMIC pseudo-VBL timer is stopped when the object is destroyed.

This commit is contained in:
Mihai Parparita 2024-03-07 23:20:59 -08:00
parent 2f326a8199
commit f218a38294
2 changed files with 10 additions and 2 deletions

View File

@ -90,6 +90,14 @@ AMIC::AMIC() : MMIODevice()
this->swim3->set_dma_channel(this->floppy_dma.get());
}
AMIC::~AMIC()
{
if (this->pseudo_vbl_tid) {
TimerManager::get_instance()->cancel_timer(this->pseudo_vbl_tid);
this->pseudo_vbl_tid = 0;
}
}
int AMIC::device_postinit()
{
MemCtrlBase *mem_ctrl = dynamic_cast<MemCtrlBase *>

View File

@ -275,7 +275,7 @@ enum AMICReg : uint32_t {
class AMIC : public MMIODevice, public InterruptCtrl {
public:
AMIC();
~AMIC() = default;
~AMIC();
static std::unique_ptr<HWComponent> create() {
return std::unique_ptr<AMIC>(new AMIC());
@ -336,7 +336,7 @@ private:
uint8_t via2_slot_ifr = 0x7F; // reverse logic
uint8_t via2_slot_irq = 0; // normal logic
uint32_t pseudo_vbl_tid; // ID for the pseudo-VBL timer
uint32_t pseudo_vbl_tid = 0; // ID for the pseudo-VBL timer
// AMIC subdevice instances
Sc53C94* scsi;