diff --git a/src/devices/cpu/drcuml.cpp b/src/devices/cpu/drcuml.cpp index a835cb01bda..e4a6ae8f57f 100644 --- a/src/devices/cpu/drcuml.cpp +++ b/src/devices/cpu/drcuml.cpp @@ -121,11 +121,12 @@ drcbe_interface::~drcbe_interface() drcuml_state::drcuml_state(device_t &device, drc_cache &cache, UINT32 flags, int modes, int addrbits, int ignorebits) : m_device(device), m_cache(cache), - m_beintf(device.machine().options().drc_use_c() ? - *static_cast(auto_alloc(device.machine(), drcbe_c(*this, device, cache, flags, modes, addrbits, ignorebits))) : - *static_cast(auto_alloc(device.machine(), drcbe_native(*this, device, cache, flags, modes, addrbits, ignorebits)))), + m_drcbe_interface(device.machine().options().drc_use_c() ? + std::unique_ptr{ std::make_unique(*this, device, cache, flags, modes, addrbits, ignorebits) } : + std::unique_ptr{ std::make_unique(*this, device, cache, flags, modes, addrbits, ignorebits) }), + m_beintf(*m_drcbe_interface.get()), m_umllog(nullptr) -{ +{ // if we're to log, create the logfile if (device.machine().options().drc_log_uml()) { @@ -141,9 +142,6 @@ drcuml_state::drcuml_state(device_t &device, drc_cache &cache, UINT32 flags, int drcuml_state::~drcuml_state() { - // free the back-end - auto_free(m_device.machine(), &m_beintf); - // close any files if (m_umllog != nullptr) fclose(m_umllog); diff --git a/src/devices/cpu/drcuml.h b/src/devices/cpu/drcuml.h index cb24396c655..9c13d1110b3 100644 --- a/src/devices/cpu/drcuml.h +++ b/src/devices/cpu/drcuml.h @@ -226,6 +226,7 @@ private: // internal state device_t & m_device; // CPU device we are associated with drc_cache & m_cache; // pointer to the codegen cache + std::unique_ptr m_drcbe_interface; drcbe_interface & m_beintf; // backend interface pointer FILE * m_umllog; // handle to the UML logfile simple_list m_blocklist; // list of active blocks