From eab1e228c8a2e6e49bb02bdde2d4511ca72e5e2e Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Wed, 29 Sep 2021 13:52:40 +0800 Subject: [PATCH] Fix LineEdit undo crash Make sure all related member variables are initialized before creating the first undo state. --- scene/gui/line_edit.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 72f88b89595..71dfda52c50 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -1919,8 +1919,6 @@ void LineEdit::_bind_methods() { } LineEdit::LineEdit() { - undo_stack_pos = nullptr; - _create_undo_state(); align = ALIGN_LEFT; cached_width = 0; cached_placeholder_width = 0; @@ -1938,6 +1936,9 @@ LineEdit::LineEdit() { shortcut_keys_enabled = true; selecting_enabled = true; + undo_stack_pos = nullptr; + _create_undo_state(); + deselect(); set_focus_mode(FOCUS_ALL); set_default_cursor_shape(CURSOR_IBEAM);