Fix UI freeze on macOS game-list population

it seems like the initial call to `GameList::PopulateAsync` in the window constructor is too early in the app life-cycle and doesn't run asynchronously, or Qt is using macOS API in an esoteric way, or maybe it's something else entirely.

Moving the list population to happen before the window is shown instead appears to fix the issue.
This commit is contained in:
TeamPuzel 2026-02-25 02:39:48 +01:00 committed by OpenSauce
parent 0f9d5f29f3
commit fe2f637467
2 changed files with 6 additions and 3 deletions

View file

@ -432,9 +432,6 @@ GMainWindow::GMainWindow(Core::System& system_)
}
#endif
game_list->LoadCompatibilityList();
game_list->PopulateAsync(UISettings::values.game_dirs);
mouse_hide_timer.setInterval(default_mouse_timeout);
connect(&mouse_hide_timer, &QTimer::timeout, this, &GMainWindow::HideMouseCursor);
connect(ui->menubar, &QMenuBar::hovered, this, &GMainWindow::OnMouseActivity);
@ -3738,6 +3735,11 @@ void GMainWindow::mouseReleaseEvent([[maybe_unused]] QMouseEvent* event) {
OnMouseActivity();
}
void GMainWindow::showEvent([[maybe_unused]] QShowEvent* event) {
game_list->LoadCompatibilityList();
game_list->PopulateAsync(UISettings::values.game_dirs);
}
void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string details) {
QString status_message;

View file

@ -461,6 +461,7 @@ protected:
void mouseMoveEvent(QMouseEvent* event) override;
void mousePressEvent(QMouseEvent* event) override;
void mouseReleaseEvent(QMouseEvent* event) override;
void showEvent(QShowEvent* event) override;
};
class GApplicationEventFilter : public QObject {