Qt: Don't read g_main_window on core thread

pull/3718/head
Stenzek 5 months ago
parent 05d470be1c
commit 0033212b2f
No known key found for this signature in database

@ -1496,7 +1496,7 @@ void System::ApplySettings(bool display_osd_messages)
}
CheckForSettingsChanges(old_settings);
Host::CheckForSettingsChanges(old_settings);
Host::OnSettingsReloaded();
}
void System::ReloadGameSettings(bool display_osd_messages)

@ -94,7 +94,7 @@ namespace Host {
void LoadSettings(const SettingsInterface& si, std::unique_lock<std::mutex>& lock);
/// Called after settings are updated.
void CheckForSettingsChanges(const Settings& old_settings);
void OnSettingsReloaded();
/// Called when the VM is starting initialization, but has not been completed yet.
void OnSystemStarting();

@ -2606,6 +2606,7 @@ void MainWindow::connectSignals()
connect(g_core_thread, &CoreThread::onReleaseRenderWindowRequested, this, &MainWindow::releaseRenderWindow);
connect(g_core_thread, &CoreThread::onResizeRenderWindowRequested, this, &MainWindow::displayResizeRequested,
Qt::BlockingQueuedConnection);
connect(g_core_thread, &CoreThread::settingsReloaded, this, &MainWindow::onSettingsReloaded);
connect(g_core_thread, &CoreThread::systemStarting, this, &MainWindow::onSystemStarting);
connect(g_core_thread, &CoreThread::systemStarted, this, &MainWindow::onSystemStarted);
connect(g_core_thread, &CoreThread::systemStopping, this, &MainWindow::onSystemStopping);
@ -2787,7 +2788,8 @@ SettingsWindow* MainWindow::getSettingsWindow()
if (!m_settings_window)
{
m_settings_window = new SettingsWindow();
connect(m_settings_window, &SettingsWindow::debugOptionsVisibiltyChanged, this, &MainWindow::updateDebugMenuVisibility);
connect(m_settings_window, &SettingsWindow::debugOptionsVisibiltyChanged, this,
&MainWindow::updateDebugMenuVisibility);
}
return m_settings_window;
@ -3132,7 +3134,7 @@ void MainWindow::requestExit(bool allow_confirm /* = true */)
requestShutdown(allow_confirm, true, g_settings.save_state_on_exit, true, true, true, true);
}
void MainWindow::checkForSettingChanges()
void MainWindow::onSettingsReloaded()
{
#ifdef _WIN32
if (const bool disable_window_rounded_corners =

@ -131,7 +131,6 @@ public:
void requestShutdown(bool allow_confirm, bool allow_save_to_state, bool save_state, bool check_safety,
bool check_pause, bool exit_fullscreen_ui, bool quit_afterwards);
void requestExit(bool allow_confirm = true);
void checkForSettingChanges();
std::optional<WindowInfo> getWindowInfo();
void recreate();
@ -236,6 +235,7 @@ private:
void onSettingsResetToDefault(bool system, bool controller);
void updateDebugMenuVisibility();
void onSettingsReloaded();
void onSystemStarting();
void onSystemStarted();
void onSystemStopping();

@ -865,11 +865,9 @@ void Host::LoadSettings(const SettingsInterface& si, std::unique_lock<std::mutex
{
}
void Host::CheckForSettingsChanges(const Settings& old_settings)
void Host::OnSettingsReloaded()
{
// NOTE: emu thread, push to UI thread
if (g_main_window)
QMetaObject::invokeMethod(g_main_window, &MainWindow::checkForSettingChanges, Qt::QueuedConnection);
emit g_core_thread->settingsReloaded();
}
void CoreThread::setDefaultSettings(bool host, bool system, bool controller)

@ -104,6 +104,7 @@ Q_SIGNALS:
void errorReported(const QString& title, const QString& message);
void statusMessage(const QString& message);
void settingsResetToDefault(bool host, bool system, bool controller);
void settingsReloaded();
void systemStarting();
void systemStarted();
void systemStopping();

@ -205,7 +205,7 @@ void Host::LoadSettings(const SettingsInterface& si, std::unique_lock<std::mutex
{
}
void Host::CheckForSettingsChanges(const Settings& old_settings)
void Host::OnSettingsReloaded()
{
}

Loading…
Cancel
Save