1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-24 13:34:27 +00:00

Merge pull request #8650 from luis-pereira/fix-invalid-iterator-crash

Fix crashes due to invalid iterator use
This commit is contained in:
sledgehammer999 2018-04-10 16:18:44 +03:00 committed by GitHub
commit d997d887e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,6 +35,7 @@
#include <QMessageBox>
#include "base/bittorrent/session.h"
#include "base/global.h"
#include "categoryfiltermodel.h"
#include "categoryfilterproxymodel.h"
#include "guiiconprovider.h"
@ -232,8 +233,7 @@ void CategoryFilterWidget::removeCategory()
void CategoryFilterWidget::removeUnusedCategories()
{
auto session = BitTorrent::Session::instance();
for (auto i = session->categories().cbegin(); i != session->categories().cend(); ++i) {
const QString &category = i.key();
for (const QString &category : copyAsConst(session->categories().keys())) {
if (model()->data(static_cast<CategoryFilterProxyModel *>(model())->index(category), Qt::UserRole) == 0)
session->removeCategory(category);
}