mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 05:38:56 +00:00
GUI: Fix dangling pointer when _headerEntryList was reallocated
As we know the size of the array in advance we can preallocate it.
This commit is contained in:
parent
148cfc1b70
commit
6a3e97d863
@ -470,6 +470,9 @@ void GridWidget::sortGroups() {
|
||||
// No filter -> display everything with group headers
|
||||
Common::sort(_groupHeaders.begin(), _groupHeaders.end());
|
||||
|
||||
// Avoid reallocation during iteration: that would invalidate our _sortedEntryList items
|
||||
_headerEntryList.reserve(_groupHeaders.size());
|
||||
|
||||
for (uint i = 0; i != _groupHeaders.size(); ++i) {
|
||||
Common::U32String header = _groupHeaders[i];
|
||||
Common::U32String displayedHeader;
|
||||
|
Loading…
Reference in New Issue
Block a user