[Scummvm-git-logs] scummvm branch-2-6 -> 4213af246964f1672d348f595a779694631a4f51
criezy
noreply at scummvm.org
Mon Jun 20 23:33:54 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
4213af2469 GUI: Fix crash in GridWidget when adding game to grid launcher
Commit: 4213af246964f1672d348f595a779694631a4f51
https://github.com/scummvm/scummvm/commit/4213af246964f1672d348f595a779694631a4f51
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2022-06-21T00:33:46+01:00
Commit Message:
GUI: Fix crash in GridWidget when adding game to grid launcher
The crash was not systematic but occured in the case where adding
the game did not change the indexes for the first and last visible
items. The issue was that in setEntryList() was called it did not
cleat the _visibleEntryList array that still contained dangling
pointers to the old items in the _dataEntryList. In most cases
the _visibleEntryList would be updated with pointers to the new
items when calcVisibleEntries() was called from reflowLayout(),
before being used in assignEntriesToItems() (also called from
reflowLayout()). But if the indexes of the first and last visible
items did not change, _visibleEntryList was not updated and we
got a crash in assignEntriesToItems() when trying to access freed
memory.
Changed paths:
gui/widgets/grid.cpp
diff --git a/gui/widgets/grid.cpp b/gui/widgets/grid.cpp
index dc8e1165629..d786d43da84 100644
--- a/gui/widgets/grid.cpp
+++ b/gui/widgets/grid.cpp
@@ -415,6 +415,8 @@ void GridWidget::setEntryList(Common::Array<GridItemInfo> *list) {
_dataEntryList.clear();
_headerEntryList.clear();
_sortedEntryList.clear();
+ _visibleEntryList.clear();
+ _isGridInvalid = true;
_selectedEntry = nullptr;
for (Common::Array<GridItemInfo>::iterator entryIter = list->begin(); entryIter != list->end(); ++entryIter) {
More information about the Scummvm-git-logs
mailing list