Move call to legacy device's stop function to device_stop() from the

destructor, in case the device tries to do something machine-related.
This commit is contained in:
Aaron Giles 2011-04-30 18:38:27 +00:00
parent 06c4761151
commit 4bde2a6110
2 changed files with 15 additions and 6 deletions

View File

@ -77,12 +77,6 @@ legacy_device_base::legacy_device_base(const machine_config &mconfig, device_typ
legacy_device_base::~legacy_device_base()
{
if (m_started)
{
device_stop_func stop_func = reinterpret_cast<device_stop_func>(get_legacy_fct(DEVINFO_FCT_STOP));
if (stop_func != NULL)
(*stop_func)(this);
}
global_free(m_token);
global_free(m_inline_config);
}
@ -238,6 +232,20 @@ void legacy_device_base::device_reset()
}
//-------------------------------------------------
// device_stop - called to stop a device
//-------------------------------------------------
void legacy_device_base::device_stop()
{
if (m_started)
{
device_stop_func stop_func = reinterpret_cast<device_stop_func>(get_legacy_fct(DEVINFO_FCT_STOP));
if (stop_func != NULL)
(*stop_func)(this);
}
}
//**************************************************************************
// LEGACY SOUND DEVICE

View File

@ -432,6 +432,7 @@ protected:
virtual bool device_validity_check(emu_options &options, const game_driver &driver) const;
virtual void device_start();
virtual void device_reset();
virtual void device_stop();
// access to legacy configuration info
INT64 get_legacy_int(UINT32 state) const;