mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-29 19:10:26 +00:00
LibGUI: Resize the mapping rows during sort
SortingProxyModel always expected the source model to have the same number of rows as long as it has not been invalidated. Now that we have granular updates, this assumption is no longer true, and we need to resize the source/proxy_rows vectors to the new size. This is safe since the values in the vector are overwritten right afterwards.
This commit is contained in:
parent
7ba321c91b
commit
265e2832ef
Notes:
sideshowbarker
2024-07-18 07:14:36 +09:00
Author: https://github.com/sin-ack Commit: https://github.com/SerenityOS/serenity/commit/265e2832efe Pull-request: https://github.com/SerenityOS/serenity/pull/9269 Reviewed-by: https://github.com/AtkinsSJ Reviewed-by: https://github.com/awesomekling
1 changed files with 3 additions and 0 deletions
|
@ -175,6 +175,9 @@ void SortingProxyModel::sort_mapping(Mapping& mapping, int column, SortOrder sor
|
|||
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)
|
||||
mapping.source_rows[i] = i;
|
||||
|
||||
|
|
Loading…
Reference in a new issue