emumem: Fix bad destruction order by not removing the notifier on cache destruction, they're supposed to be long-lived anyway [O. Galibert]

This commit is contained in:
Olivier Galibert 2020-06-18 18:22:40 +02:00
parent a7c369c993
commit e96ed3b0eb

View File

@ -1150,8 +1150,6 @@ public:
private:
address_space * m_space;
int m_notifier_id; // id to remove the notifier on destruction
offs_t m_addrmask; // address mask
offs_t m_addrstart_r; // minimum valid address for reading
offs_t m_addrend_r; // maximum valid address for reading
@ -2004,18 +2002,18 @@ set(address_space *space, std::pair<void *, void *> rw)
m_space = space;
m_addrmask = space->addrmask();
m_notifier_id = space->add_change_notifier([this](read_or_write mode) {
if(u32(mode) & u32(read_or_write::READ)) {
m_addrend_r = 0;
m_addrstart_r = 1;
m_cache_r = nullptr;
}
if(u32(mode) & u32(read_or_write::WRITE)) {
m_addrend_w = 0;
m_addrstart_w = 1;
m_cache_w = nullptr;
}
});
space->add_change_notifier([this](read_or_write mode) {
if(u32(mode) & u32(read_or_write::READ)) {
m_addrend_r = 0;
m_addrstart_r = 1;
m_cache_r = nullptr;
}
if(u32(mode) & u32(read_or_write::WRITE)) {
m_addrend_w = 0;
m_addrstart_w = 1;
m_cache_w = nullptr;
}
});
m_root_read = (handler_entry_read <Width, AddrShift, Endian> *)(rw.first);
m_root_write = (handler_entry_write<Width, AddrShift, Endian> *)(rw.second);
@ -2032,8 +2030,6 @@ template<int Width, int AddrShift, endianness_t Endian>
emu::detail::memory_access_cache<Width, AddrShift, Endian>::
~memory_access_cache()
{
if(m_space)
m_space->remove_change_notifier(m_notifier_id);
}
#endif /* MAME_EMU_EMUMEM_H */