[Scummvm-git-logs] scummvm master -> 469e75cb64c4acd2914ec845915637e9144b159a
criezy
criezy at scummvm.org
Fri Nov 24 23:45:11 CET 2017
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:
469e75cb64 GUI: Fix incorrect SaveLoad dialog state after updating the save list
Commit: 469e75cb64c4acd2914ec845915637e9144b159a
https://github.com/scummvm/scummvm/commit/469e75cb64c4acd2914ec845915637e9144b159a
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2017-11-24T22:44:41Z
Commit Message:
GUI: Fix incorrect SaveLoad dialog state after updating the save list
Updating the list reset the selection in the list widget, however if
a save had previously been selected and the Choose button was enabled,
it remained enabled despite no save being selected. Trying to load
the game resulted in a crash. This was particularly an issue with
cloud enabled as if you are unlucky you could have tried to load a
save just as the cloud sync finished, which updated the list and
unselected the save. This change fixes bug #9766: Assert in
SaveLoadChooser dialog.
In addition to adding a sanity check on the selected index for the
Choose command, this commit also preserves the selection when
updating the list as I think this would be the expected behaviour
in this dialog.
Changed paths:
gui/saveload-dialog.cpp
diff --git a/gui/saveload-dialog.cpp b/gui/saveload-dialog.cpp
index 4bf23b8..cbfaaed 100644
--- a/gui/saveload-dialog.cpp
+++ b/gui/saveload-dialog.cpp
@@ -428,11 +428,13 @@ void SaveLoadChooserSimple::handleCommand(CommandSender *sender, uint32 cmd, uin
break;
case kChooseCmd:
_list->endEditMode();
- if (!_saveList.empty()) {
- setResult(_saveList[selItem].getSaveSlot());
- _resultString = _list->getSelectedString();
+ if (selItem >= 0) {
+ if (!_saveList.empty()) {
+ setResult(_saveList[selItem].getSaveSlot());
+ _resultString = _list->getSelectedString();
+ }
+ close();
}
- close();
break;
case kListSelectionChangedCmd:
updateSelection(true);
@@ -694,7 +696,13 @@ void SaveLoadChooserSimple::updateSaveList() {
colors.push_back(ThemeEngine::kFontColorNormal);
}
+ int selected = _list->getSelected();
_list->setList(saveNames, &colors);
+ if (selected >= 0 && selected < saveNames.size())
+ _list->setSelected(selected);
+ else
+ _chooseButton->setEnabled(false);
+
draw();
}
More information about the Scummvm-git-logs
mailing list