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

Partial revert eac8838dc241f22f2aab9508633fdb2921373b7c. Fixes #7952.

mapFromSource() didn't work as expected, when used in lessThan(), it sometimes
returns an invalid QModelIndex.
A crash is observed when filtering source model via filterAcceptsRow() in #7952,
the crash is due to endless recursive of filterAcceptsRow() & lessThan() calling
each other and mapFromSource() is the culprit of it.
This commit is contained in:
Chocobo1 2017-12-01 23:08:25 +08:00
parent f457937980
commit 86c5a8df75
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
5 changed files with 7 additions and 7 deletions

View File

@ -57,5 +57,5 @@ bool CategoryFilterProxyModel::lessThan(const QModelIndex &left, const QModelInd
if (result != 0)
return (result < 0);
return (mapFromSource(left) < mapFromSource(right));
return (left < right);
}

View File

@ -56,14 +56,14 @@ protected:
if (result != 0)
return (result < 0);
return (mapFromSource(left) < mapFromSource(right));
return (left < right);
}
break;
default:
if (left.data() != right.data())
return QSortFilterProxyModel::lessThan(left, right);
return (mapFromSource(left) < mapFromSource(right));
return (left < right);
};
}
};

View File

@ -116,14 +116,14 @@ bool SearchSortModel::lessThan(const QModelIndex &left, const QModelIndex &right
if (result != 0)
return (result < 0);
return (mapFromSource(left) < mapFromSource(right));
return (left < right);
}
break;
default:
if (left.data() != right.data())
return base::lessThan(left, right);
return (mapFromSource(left) < mapFromSource(right));
return (left < right);
};
}

View File

@ -57,5 +57,5 @@ bool TagFilterProxyModel::lessThan(const QModelIndex &left, const QModelIndex &r
if (result != 0)
return (result < 0);
return (mapFromSource(left) < mapFromSource(right));
return (left < right);
}

View File

@ -98,7 +98,7 @@ bool TransferListSortModel::lessThan(const QModelIndex &left, const QModelIndex
if (result != 0)
return (result < 0);
return (mapFromSource(left) < mapFromSource(right));
return (left < right);
}
case TorrentModel::TR_ADD_DATE: