From 917c08cd5f87bd06e872b6fb99e00cb5ef5d0066 Mon Sep 17 00:00:00 2001 From: Al Date: Tue, 22 Jan 2019 13:26:52 +0100 Subject: Fixed a crash with "Disable Selected" while in "checked" filter and similar cases --- src/mainwindow.cpp | 6 ++++++ src/modlist.cpp | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 7f79cb0e..df78df82 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -5020,12 +5020,18 @@ void MainWindow::sendSelectedPluginsToPriority_clicked() void MainWindow::enableSelectedMods_clicked() { m_OrganizerCore.modList()->enableSelected(ui->modList->selectionModel()); + if (m_ModListSortProxy != nullptr) { + m_ModListSortProxy->invalidate(); + } } void MainWindow::disableSelectedMods_clicked() { m_OrganizerCore.modList()->disableSelected(ui->modList->selectionModel()); + if (m_ModListSortProxy != nullptr) { + m_ModListSortProxy->invalidate(); + } } diff --git a/src/modlist.cpp b/src/modlist.cpp index 9835d3b9..58fe95d5 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -1327,7 +1327,7 @@ bool ModList::eventFilter(QObject *obj, QEvent *event) return QAbstractItemModel::eventFilter(obj, event); } - +//note: caller needs to make sure sort proxy is updated void ModList::enableSelected(const QItemSelectionModel *selectionModel) { if (selectionModel->hasSelection()) { @@ -1336,13 +1336,12 @@ void ModList::enableSelected(const QItemSelectionModel *selectionModel) int modID = m_Profile->modIndexByPriority(row.data().toInt()); if (!m_Profile->modEnabled(modID)) { m_Profile->setModEnabled(modID, true); - emit modlist_changed(row, 0); } } } } - +//note: caller needs to make sure sort proxy is updated void ModList::disableSelected(const QItemSelectionModel *selectionModel) { if (selectionModel->hasSelection()) { @@ -1351,8 +1350,9 @@ void ModList::disableSelected(const QItemSelectionModel *selectionModel) int modID = m_Profile->modIndexByPriority(row.data().toInt()); if (m_Profile->modEnabled(modID)) { m_Profile->setModEnabled(modID, false); - emit modlist_changed(row, 0); } } + + } } -- cgit v1.3.1