qt: unregister Settings' DevicesChanged callback during shutdown
fixes a crash on close
This commit is contained in:
parent
f7f47d3cd0
commit
27dd2c4aa4
|
@ -360,6 +360,8 @@ void MainWindow::ShutdownControllers()
|
||||||
{
|
{
|
||||||
m_hotkey_scheduler->Stop();
|
m_hotkey_scheduler->Stop();
|
||||||
|
|
||||||
|
Settings::Instance().UnregisterDevicesChangedCallback();
|
||||||
|
|
||||||
Pad::Shutdown();
|
Pad::Shutdown();
|
||||||
Pad::ShutdownGBA();
|
Pad::ShutdownGBA();
|
||||||
Keyboard::Shutdown();
|
Keyboard::Shutdown();
|
||||||
|
|
|
@ -69,7 +69,7 @@ Settings::Settings()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
g_controller_interface.RegisterDevicesChangedCallback([this] {
|
m_hotplug_callback_handle = g_controller_interface.RegisterDevicesChangedCallback([this] {
|
||||||
if (Host::GetInstance()->IsHostThread())
|
if (Host::GetInstance()->IsHostThread())
|
||||||
{
|
{
|
||||||
emit DevicesChanged();
|
emit DevicesChanged();
|
||||||
|
@ -90,6 +90,11 @@ Settings::Settings()
|
||||||
|
|
||||||
Settings::~Settings() = default;
|
Settings::~Settings() = default;
|
||||||
|
|
||||||
|
void Settings::UnregisterDevicesChangedCallback()
|
||||||
|
{
|
||||||
|
g_controller_interface.UnregisterDevicesChangedCallback(m_hotplug_callback_handle);
|
||||||
|
}
|
||||||
|
|
||||||
Settings& Settings::Instance()
|
Settings& Settings::Instance()
|
||||||
{
|
{
|
||||||
static Settings settings;
|
static Settings settings;
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
#include "Core/Config/MainSettings.h"
|
#include "Core/Config/MainSettings.h"
|
||||||
#include "DiscIO/Enums.h"
|
#include "DiscIO/Enums.h"
|
||||||
|
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
||||||
|
|
||||||
namespace Core
|
namespace Core
|
||||||
{
|
{
|
||||||
|
@ -44,6 +45,8 @@ public:
|
||||||
|
|
||||||
~Settings();
|
~Settings();
|
||||||
|
|
||||||
|
void UnregisterDevicesChangedCallback();
|
||||||
|
|
||||||
static Settings& Instance();
|
static Settings& Instance();
|
||||||
static QSettings& GetQSettings();
|
static QSettings& GetQSettings();
|
||||||
|
|
||||||
|
@ -199,10 +202,12 @@ signals:
|
||||||
void USBKeyboardConnectionChanged(bool connected);
|
void USBKeyboardConnectionChanged(bool connected);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Settings();
|
||||||
|
|
||||||
bool m_batch = false;
|
bool m_batch = false;
|
||||||
std::shared_ptr<NetPlay::NetPlayClient> m_client;
|
std::shared_ptr<NetPlay::NetPlayClient> m_client;
|
||||||
std::shared_ptr<NetPlay::NetPlayServer> m_server;
|
std::shared_ptr<NetPlay::NetPlayServer> m_server;
|
||||||
Settings();
|
ControllerInterface::HotplugCallbackHandle m_hotplug_callback_handle;
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(Core::State);
|
Q_DECLARE_METATYPE(Core::State);
|
||||||
|
|
Loading…
Reference in New Issue