Fix image unload (nw)

This commit is contained in:
Miodrag Milanovic 2016-01-14 14:10:36 +01:00
parent 2c0cf88891
commit 7f02a9e47b
2 changed files with 13 additions and 4 deletions

View File

@ -51,6 +51,9 @@ image_manager::image_manager(running_machine &machine)
std::string image_err = std::string(image->error()); std::string image_err = std::string(image->error());
std::string image_basename(image_name); std::string image_basename(image_name);
/* unload all images */
unload_all();
fatalerror_exitcode(machine, MAMERR_DEVICE, "Device %s load (%s) failed: %s", fatalerror_exitcode(machine, MAMERR_DEVICE, "Device %s load (%s) failed: %s",
image->device().name(), image->device().name(),
image_basename.c_str(), image_basename.c_str(),
@ -63,9 +66,10 @@ image_manager::image_manager(running_machine &machine)
} }
//------------------------------------------------- //-------------------------------------------------
// image_manager - destructor // unload_all - unload all images and
// extract options
//------------------------------------------------- //-------------------------------------------------
image_manager::~image_manager() void image_manager::unload_all()
{ {
// extract the options // extract the options
options_extract(); options_extract();
@ -228,10 +232,15 @@ void image_manager::postdevice_init()
/* retrieve image error message */ /* retrieve image error message */
std::string image_err = std::string(image->error()); std::string image_err = std::string(image->error());
/* unload all images */
unload_all();
fatalerror_exitcode(machine(), MAMERR_DEVICE, "Device %s load failed: %s", fatalerror_exitcode(machine(), MAMERR_DEVICE, "Device %s load failed: %s",
image->device().name(), image->device().name(),
image_err.c_str()); image_err.c_str());
} }
} }
/* add a callback for when we shut down */
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(image_manager::unload_all), this));
} }

View File

@ -20,8 +20,8 @@ class image_manager
public: public:
// construction/destruction // construction/destruction
image_manager(running_machine &machine); image_manager(running_machine &machine);
~image_manager();
void unload_all();
void postdevice_init(); void postdevice_init();
std::string &mandatory_scan(std::string &mandatory); std::string &mandatory_scan(std::string &mandatory);