mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 21:47:43 +00:00
LibGUI: Always resize the mapping rows when sorting
Prior this change, creating a file or directory on Desktop crashed the desktop instance of FileManager. Closes: #9560
This commit is contained in:
parent
38e0d1b456
commit
219206725b
1 changed files with 4 additions and 5 deletions
|
@ -163,8 +163,11 @@ ModelIndex SortingProxyModel::parent_index(const ModelIndex& proxy_index) const
|
||||||
|
|
||||||
void SortingProxyModel::sort_mapping(Mapping& mapping, int column, SortOrder sort_order)
|
void SortingProxyModel::sort_mapping(Mapping& mapping, int column, SortOrder sort_order)
|
||||||
{
|
{
|
||||||
|
int row_count = source().row_count(mapping.source_parent);
|
||||||
|
mapping.source_rows.resize(row_count);
|
||||||
|
mapping.proxy_rows.resize(row_count);
|
||||||
|
|
||||||
if (column == -1) {
|
if (column == -1) {
|
||||||
int row_count = source().row_count(mapping.source_parent);
|
|
||||||
for (int i = 0; i < row_count; ++i) {
|
for (int i = 0; i < row_count; ++i) {
|
||||||
mapping.source_rows[i] = i;
|
mapping.source_rows[i] = i;
|
||||||
mapping.proxy_rows[i] = i;
|
mapping.proxy_rows[i] = i;
|
||||||
|
@ -174,10 +177,6 @@ void SortingProxyModel::sort_mapping(Mapping& mapping, int column, SortOrder sor
|
||||||
|
|
||||||
auto old_source_rows = mapping.source_rows;
|
auto old_source_rows = mapping.source_rows;
|
||||||
|
|
||||||
int row_count = source().row_count(mapping.source_parent);
|
|
||||||
mapping.source_rows.resize(row_count);
|
|
||||||
mapping.proxy_rows.resize(row_count);
|
|
||||||
|
|
||||||
for (int i = 0; i < row_count; ++i)
|
for (int i = 0; i < row_count; ++i)
|
||||||
mapping.source_rows[i] = i;
|
mapping.source_rows[i] = i;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue