Qt: fix possible race in RepaintIcons

This might also improve performance while scrubbing the icon size slider
This commit is contained in:
Megamouse 2021-06-09 23:53:36 +02:00
parent 27cc5c8a63
commit 2dc6adc038

View File

@ -2014,6 +2014,12 @@ void game_list_frame::ResizeIcons(const int& slider_pos)
void game_list_frame::RepaintIcons(const bool& from_settings)
{
if (m_repaint_watcher.isRunning())
{
m_repaint_watcher.cancel();
m_repaint_watcher.waitForFinished();
}
if (from_settings)
{
if (m_gui_settings->GetValue(gui::m_enableUIColors).toBool())
@ -2051,12 +2057,6 @@ void game_list_frame::RepaintIcons(const bool& from_settings)
m_game_list->resizeColumnToContents(gui::column_count - 1);
}
if (m_repaint_watcher.isRunning())
{
m_repaint_watcher.cancel();
m_repaint_watcher.waitForFinished();
}
const std::function func = [this](const game_info& game) -> movie_item*
{
if (game->icon.isNull() && (game->info.icon_path.empty() || !game->icon.load(qstr(game->info.icon_path))))