From 040bddafa6e97ab18b9f96436b05d5df885bbae6 Mon Sep 17 00:00:00 2001 From: Michael Maltese Date: Wed, 31 May 2017 21:11:54 -0700 Subject: [PATCH] MainWindow: shutdown different input interfaces `MainWindow` initializes a number of input interfaces but never shuts them down. This was causing a crash-after-exit on macOS where the ControllerInterface backend stores a `std::thread` object in a static variable and only stops it when ControllerInterface::Shutdown is called. --- Source/Core/DolphinQt2/MainWindow.cpp | 10 ++++++++++ Source/Core/DolphinQt2/MainWindow.h | 1 + 2 files changed, 11 insertions(+) diff --git a/Source/Core/DolphinQt2/MainWindow.cpp b/Source/Core/DolphinQt2/MainWindow.cpp index d60c0ac415..c003f5be04 100644 --- a/Source/Core/DolphinQt2/MainWindow.cpp +++ b/Source/Core/DolphinQt2/MainWindow.cpp @@ -52,6 +52,7 @@ MainWindow::MainWindow() : QMainWindow(nullptr) MainWindow::~MainWindow() { m_render_widget->deleteLater(); + ShutdownControllers(); } void MainWindow::InitControllers() @@ -66,6 +67,15 @@ void MainWindow::InitControllers() HotkeyManagerEmu::Initialize(); } +void MainWindow::ShutdownControllers() +{ + g_controller_interface.Shutdown(); + Pad::Shutdown(); + Keyboard::Shutdown(); + Wiimote::Shutdown(); + HotkeyManagerEmu::Shutdown(); +} + void MainWindow::CreateComponents() { m_menu_bar = new MenuBar(this); diff --git a/Source/Core/DolphinQt2/MainWindow.h b/Source/Core/DolphinQt2/MainWindow.h index c2917c1ac0..cc617c3ac0 100644 --- a/Source/Core/DolphinQt2/MainWindow.h +++ b/Source/Core/DolphinQt2/MainWindow.h @@ -66,6 +66,7 @@ private: void ConnectPathsDialog(); void InitControllers(); + void ShutdownControllers(); void StartGame(const QString& path); void ShowRenderWidget();