Qt: Fix gamelist icon after stopping a movie

Do not set an icon if it's null. This happens because we save memory
by clearing the pixmap of non-movie items.
Also don't stop the movie here, as it should be stopped already anyway.
This commit is contained in:
Megamouse 2025-04-16 02:37:48 +02:00
parent e80809f629
commit 9295e6f5c8
2 changed files with 10 additions and 10 deletions

View file

@ -91,19 +91,19 @@ void game_list_grid::populate(
if (const QPixmap pixmap = item->get_movie_image(frame); item->get_active() && !pixmap.isNull())
{
item->set_icon(gui::utils::get_centered_pixmap(pixmap, m_icon_size, 0, 0, 1.0, Qt::FastTransformation));
return;
}
else
{
std::lock_guard lock(item->pixmap_mutex);
std::lock_guard lock(item->pixmap_mutex);
if (!game->pxmap.isNull())
{
item->set_icon(game->pxmap);
if (!game->has_hover_gif && !game->has_hover_pam)
{
game->pxmap = {};
}
item->stop_movie();
}
});

View file

@ -252,19 +252,19 @@ void game_list_table::populate(
if (const QPixmap pixmap = icon_item->get_movie_image(frame); icon_item->get_active() && !pixmap.isNull())
{
icon_item->setData(Qt::DecorationRole, pixmap.scaled(m_icon_size, Qt::KeepAspectRatio));
return;
}
else
{
std::lock_guard lock(icon_item->pixmap_mutex);
std::lock_guard lock(icon_item->pixmap_mutex);
if (!game->pxmap.isNull())
{
icon_item->setData(Qt::DecorationRole, game->pxmap);
if (!game->has_hover_gif && !game->has_hover_pam)
{
game->pxmap = {};
}
icon_item->stop_movie();
}
});