qt: unregister Settings' DevicesChanged callback during shutdown

fixes a crash on close
This commit is contained in:
Shawn Hoffman
2022-06-02 23:32:21 -07:00
parent f7f47d3cd0
commit 27dd2c4aa4
3 changed files with 14 additions and 2 deletions

View File

@ -69,7 +69,7 @@ Settings::Settings()
}
});
g_controller_interface.RegisterDevicesChangedCallback([this] {
m_hotplug_callback_handle = g_controller_interface.RegisterDevicesChangedCallback([this] {
if (Host::GetInstance()->IsHostThread())
{
emit DevicesChanged();
@ -90,6 +90,11 @@ Settings::Settings()
Settings::~Settings() = default;
void Settings::UnregisterDevicesChangedCallback()
{
g_controller_interface.UnregisterDevicesChangedCallback(m_hotplug_callback_handle);
}
Settings& Settings::Instance()
{
static Settings settings;