Improvements to ruby driver crash detection.
Workaround added for rare crash on close on Windows.
This commit is contained in:
byuu 2019-12-08 01:39:46 +09:00
parent dafd673177
commit 6aa7c944d5
2 changed files with 14 additions and 3 deletions

View File

@ -29,7 +29,7 @@ using namespace nall;
namespace Emulator { namespace Emulator {
static const string Name = "bsnes"; static const string Name = "bsnes";
static const string Version = "112.12"; static const string Version = "112.13";
static const string Author = "byuu"; static const string Author = "byuu";
static const string License = "GPLv3"; static const string License = "GPLv3";
static const string Website = "https://byuu.org"; static const string Website = "https://byuu.org";

View File

@ -44,8 +44,7 @@ auto Program::create() -> void {
stateManager.create(); stateManager.create();
manifestViewer.create(); manifestViewer.create();
//seems to be misfiring on Windows, so disable for now if(settings.general.crashed) {
if(0 && settings.general.crashed) {
MessageDialog( MessageDialog(
"Driver crash detected. Hardware drivers have been disabled.\n" "Driver crash detected. Hardware drivers have been disabled.\n"
"Please reconfigure drivers in the advanced settings panel." "Please reconfigure drivers in the advanced settings panel."
@ -124,10 +123,22 @@ auto Program::quit() -> void {
presentation.setVisible(false); presentation.setVisible(false);
Application::processEvents(); Application::processEvents();
//in case the emulator was closed prior to initialization completing:
settings.general.crashed = false;
unload(); unload();
settings.save(); settings.save();
video.reset(); video.reset();
audio.reset(); audio.reset();
input.reset(); input.reset();
#if defined(PLATFORM_WINDOWS)
//in rare cases, when Application::exit() calls exit(0), a crash will occur.
//this seems to be due to the internal state of certain ruby drivers.
auto processID = GetCurrentProcessId();
auto handle = OpenProcess(SYNCHRONIZE | PROCESS_TERMINATE, true, processID);
TerminateProcess(handle, 0);
#endif
Application::exit(); Application::exit();
} }