From ed0abf39129e16e6120bde099d6c7eaed3339f73 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Tue, 10 Mar 2020 22:59:17 +1000 Subject: [PATCH] Qt: Fix possible assertion failure when removing search directories --- src/duckstation-qt/gamelistwidget.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/duckstation-qt/gamelistwidget.cpp b/src/duckstation-qt/gamelistwidget.cpp index 4a8593f17..34d68c016 100644 --- a/src/duckstation-qt/gamelistwidget.cpp +++ b/src/duckstation-qt/gamelistwidget.cpp @@ -38,8 +38,7 @@ public: return std::nullopt; } - GameListModel(GameList* game_list, QObject* parent = nullptr) - : QAbstractTableModel(parent), m_game_list(game_list), m_size(static_cast(m_game_list->GetEntryCount())) + GameListModel(GameList* game_list, QObject* parent = nullptr) : QAbstractTableModel(parent), m_game_list(game_list) { loadCommonImages(); } @@ -178,15 +177,8 @@ public: void refresh() { - if (m_size > 0) - { - beginRemoveRows(QModelIndex(), 0, m_size - 1); - endRemoveRows(); - } - - m_size = static_cast(m_game_list->GetEntryCount()); - beginInsertRows(QModelIndex(), 0, m_size - 1); - endInsertRows(); + beginResetModel(); + endResetModel(); } bool titlesLessThan(int left_row, int right_row, bool ascending) const @@ -215,7 +207,6 @@ private: } GameList* m_game_list; - int m_size; QPixmap m_type_disc_pixmap; QPixmap m_type_exe_pixmap;