Fixed an issue where the 'quit' custom event would not trigger on application shutdown.

This commit is contained in:
Leon Styhre 2022-05-18 22:57:03 +02:00
parent 5b63ecb828
commit fdf63a9ad0
4 changed files with 7 additions and 9 deletions

View file

@ -1296,7 +1296,6 @@ void GuiMenu::openQuitMenu()
mWindow->pushGui(new GuiMsgBox(
this->getHelpStyle(), "REALLY QUIT?", "YES",
[this] {
Scripting::fireEvent("quit");
close(true);
Utils::Platform::quitES();
},
@ -1314,7 +1313,6 @@ void GuiMenu::openQuitMenu()
window->pushGui(new GuiMsgBox(
this->getHelpStyle(), "REALLY QUIT?", "YES",
[this] {
Scripting::fireEvent("quit");
close(true);
Utils::Platform::quitES();
},
@ -1331,8 +1329,6 @@ void GuiMenu::openQuitMenu()
window->pushGui(new GuiMsgBox(
this->getHelpStyle(), "REALLY REBOOT?", "YES",
[] {
Scripting::fireEvent("quit", "reboot");
Scripting::fireEvent("reboot");
if (Utils::Platform::quitES(Utils::Platform::QuitMode::REBOOT) != 0) {
LOG(LogWarning) << "Reboot terminated with non-zero result!";
}
@ -1350,8 +1346,6 @@ void GuiMenu::openQuitMenu()
window->pushGui(new GuiMsgBox(
this->getHelpStyle(), "REALLY POWER OFF?", "YES",
[] {
Scripting::fireEvent("quit", "poweroff");
Scripting::fireEvent("poweroff");
if (Utils::Platform::quitES(Utils::Platform::QuitMode::POWEROFF) != 0) {
LOG(LogWarning) << "Power off terminated with non-zero result!";
}

View file

@ -12,7 +12,6 @@
#include "HelpPrompt.h"
#include "InputConfig.h"
#include "Scripting.h"
#include "Settings.h"
#include "resources/TextureResource.h"

View file

@ -10,7 +10,6 @@
#include "ResourceManager.h"
#include "Log.h"
#include "Scripting.h"
#include "utils/FileSystemUtil.h"
#include "utils/PlatformUtil.h"
#include "utils/StringUtil.h"
@ -77,7 +76,6 @@ std::string ResourceManager::getResourcePath(const std::string& path, bool termi
#endif
LOG(LogError) << testExePath;
LOG(LogError) << "Has EmulationStation been properly installed?";
Scripting::fireEvent("quit");
Utils::Platform::emergencyShutdown();
}
else {

View file

@ -9,6 +9,7 @@
#include "utils/PlatformUtil.h"
#include "Log.h"
#include "Scripting.h"
#include "Window.h"
#if defined(_WIN64)
#include "utils/StringUtil.h"
@ -286,15 +287,20 @@ namespace Utils
switch (sQuitMode) {
case QuitMode::REBOOT: {
LOG(LogInfo) << "Rebooting system";
Scripting::fireEvent("quit");
Scripting::fireEvent("reboot");
runRebootCommand();
break;
}
case QuitMode::POWEROFF: {
LOG(LogInfo) << "Powering off system";
Scripting::fireEvent("quit");
Scripting::fireEvent("poweroff");
runPoweroffCommand();
break;
}
default: {
Scripting::fireEvent("quit");
break;
}
}
@ -303,6 +309,7 @@ namespace Utils
void emergencyShutdown()
{
LOG(LogError) << "Critical - Performing emergency shutdown...";
Scripting::fireEvent("quit");
Window::getInstance()->deinit();
Log::flush();