aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/UndoHistory.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2024-02-14 20:51:23 +1100
committerNeil <nyamatongwe@gmail.com>2024-02-14 20:51:23 +1100
commita6a2fe933e0103464c1a357f987ad10e3bcf6622 (patch)
tree48dfa85dce1d18329455f89320762d060421f366 /src/UndoHistory.cxx
parent4548491a4080ba8ca556a0740058a5b7e5dd4ee7 (diff)
downloadscintilla-mirror-a6a2fe933e0103464c1a357f987ad10e3bcf6622.tar.gz
Ensure no exceptions when deleting undo history.
Diffstat (limited to 'src/UndoHistory.cxx')
-rw-r--r--src/UndoHistory.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/UndoHistory.cxx b/src/UndoHistory.cxx
index 9c1b89c94..1a956b998 100644
--- a/src/UndoHistory.cxx
+++ b/src/UndoHistory.cxx
@@ -173,6 +173,11 @@ bool UndoActions::AtStart(size_t index) const noexcept {
return !types[index-1].mayCoalesce;
}
+void ScrapStack::Clear() noexcept {
+ stack.clear();
+ current = 0;
+}
+
const char *ScrapStack::Push(const char *text, size_t length) {
if (current < stack.length()) {
stack.resize(current);
@@ -341,7 +346,7 @@ void UndoHistory::DeleteUndoHistory() noexcept {
currentAction = 0;
savePoint = 0;
tentativePoint = -1;
- scraps = std::make_unique<ScrapStack>();
+ scraps->Clear();
memory = {};
}