[Scummvm-git-logs] scummvm master -> 4867e14d604a2556f77a036d9e5eff0477bd26b8
bluegr
noreply at scummvm.org
Tue Aug 22 10:23:24 UTC 2023
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:
4867e14d60 GUI: EditableWidget: Clear selection when handling backspace/delete
Commit: 4867e14d604a2556f77a036d9e5eff0477bd26b8
https://github.com/scummvm/scummvm/commit/4867e14d604a2556f77a036d9e5eff0477bd26b8
Author: PushmePullyu (127053144+PushmePullyu at users.noreply.github.com)
Date: 2023-08-22T13:23:19+03:00
Commit Message:
GUI: EditableWidget: Clear selection when handling backspace/delete
Clear the selection after deleting a character.
Not doing so can result in out-of-bounds reads in
EditTextWidget::drawWidget(), where _selCaretPos and _selOffset are
used as offsets, and to a failed assertion when calling
EditableWidget::defaultKeyDownHandler():
gui/widgets/editable.cpp:566:
bool GUI::EditableWidget::setCaretPos(int):
Assertion `newPos >= 0 && newPos <= (int)_editString.size()' failed.
Fixes #14584
Changed paths:
gui/widgets/editable.cpp
diff --git a/gui/widgets/editable.cpp b/gui/widgets/editable.cpp
index d693368c66f..82d4a386eac 100644
--- a/gui/widgets/editable.cpp
+++ b/gui/widgets/editable.cpp
@@ -261,6 +261,7 @@ bool EditableWidget::handleKeyDown(Common::KeyState state) {
deleteIndex--;
_editString.deleteChar(deleteIndex);
setCaretPos(caretVisualPos(deleteIndex));
+ _selCaretPos = -1;
dirty = true;
sendCommand(_cmd, 0);
@@ -285,6 +286,8 @@ bool EditableWidget::handleKeyDown(Common::KeyState state) {
if (deleteIndex < (int)_editString.size()) {
_editString.deleteChar(deleteIndex);
setCaretPos(caretVisualPos(deleteIndex));
+ _selCaretPos = -1;
+ _selOffset = 0;
dirty = true;
sendCommand(_cmd, 0);
More information about the Scummvm-git-logs
mailing list