For legacy CPUs, track whether we have initialized, and if we haven't,

don't call the exit callback in the destructor.
This commit is contained in:
Aaron Giles 2010-08-26 16:00:27 +00:00
parent 0cbdc36bdf
commit 1dc0cbbda6
2 changed files with 5 additions and 2 deletions

View File

@ -225,7 +225,8 @@ legacy_cpu_device::legacy_cpu_device(running_machine &machine, const legacy_cpu_
m_state_export(reinterpret_cast<cpu_state_io_func>(m_cpu_config.get_legacy_config_fct(CPUINFO_FCT_EXPORT_STATE))),
m_string_export(reinterpret_cast<cpu_string_io_func>(m_cpu_config.get_legacy_config_fct(CPUINFO_FCT_EXPORT_STRING))),
m_exit(reinterpret_cast<cpu_exit_func>(m_cpu_config.get_legacy_config_fct(CPUINFO_FCT_EXIT))),
m_using_legacy_state(false)
m_using_legacy_state(false),
m_inited(false)
{
memset(&m_partial_frame_period, 0, sizeof(m_partial_frame_period));
@ -245,7 +246,7 @@ legacy_cpu_device::legacy_cpu_device(running_machine &machine, const legacy_cpu_
legacy_cpu_device::~legacy_cpu_device()
{
// call the CPU's exit function if present
if (m_exit != NULL)
if (m_inited && m_exit != NULL)
(*m_exit)(this);
}
@ -259,6 +260,7 @@ void legacy_cpu_device::device_start()
// standard init
cpu_init_func init = reinterpret_cast<cpu_init_func>(m_cpu_config.get_legacy_config_fct(CPUINFO_FCT_INIT));
(*init)(this, static_standard_irq_callback);
m_inited = true;
// fetch information about the CPU states
if (m_state_list == NULL)

View File

@ -536,6 +536,7 @@ protected:
UINT64 m_state_io; // temporary buffer for state I/O
bool m_using_legacy_state; // true if we are using the old-style state access
bool m_inited;
};