From 2eb32ece6d1e23c96be07dd3312bb62e1a092472 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Sun, 16 Feb 2025 15:14:06 +0100 Subject: [PATCH] Fix fd2949d: std::string can reallocate on insert() --- src/textbuf.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/textbuf.cpp b/src/textbuf.cpp index 8bc5983937..a36bb12125 100644 --- a/src/textbuf.cpp +++ b/src/textbuf.cpp @@ -132,7 +132,7 @@ bool Textbuf::InsertChar(char32_t key) if (this->buf.size() + len < this->max_bytes && this->chars + 1 <= this->max_chars) { /* Make space in the string, then overwrite it with the Utf8 encoded character. */ auto pos = this->buf.begin() + this->caretpos; - this->buf.insert(pos, len, '\0'); + pos = this->buf.insert(pos, len, '\0'); Utf8Encode(pos, key); this->chars++; this->caretpos += len;