diff --git a/es-app/src/views/ViewController.cpp b/es-app/src/views/ViewController.cpp index 930250385..3fe60f91e 100644 --- a/es-app/src/views/ViewController.cpp +++ b/es-app/src/views/ViewController.cpp @@ -227,6 +227,10 @@ void ViewController::invalidAlternativeEmulatorDialog() void ViewController::goToStart(bool playTransition) { + // Needed to avoid segfaults during emergency shutdown. + if (Renderer::getSDLWindow() == nullptr) + return; + #if defined(__APPLE__) // The startup animations are very choppy on macOS as of moving to SDL 2.0.18 so the // best user experience is to simply disable them on this OS. @@ -310,6 +314,9 @@ void ViewController::cancelViewTransitions() void ViewController::stopScrolling() { + if (Renderer::getSDLWindow() == nullptr) + return; + mSystemListView->stopScrolling(); mCurrentView->stopListScrolling(); @@ -1031,6 +1038,9 @@ void ViewController::reloadGameListView(IGameListView* view, bool reloadTheme) void ViewController::reloadAll() { + if (Renderer::getSDLWindow() == nullptr) + return; + cancelViewTransitions(); // Clear all GameListViews. diff --git a/es-core/src/Platform.cpp b/es-core/src/Platform.cpp index 4a988cb9b..812427f72 100644 --- a/es-core/src/Platform.cpp +++ b/es-core/src/Platform.cpp @@ -11,7 +11,7 @@ #include "Log.h" #include "MameNames.h" #include "Settings.h" -#include "renderers/Renderer.h" +#include "Window.h" #include "utils/StringUtil.h" #include @@ -270,8 +270,7 @@ void emergencyShutdown() { LOG(LogError) << "Critical - Performing emergency shutdown..."; - // Most of the SDL deinitialization is done in Renderer. - Renderer::deinit(); + Window::getInstance()->deinit(); Log::flush(); exit(EXIT_FAILURE);