Browse Source

Fix LineEdit undo crash

Make sure all related member variables are initialized before creating
the first undo state.

(cherry picked from commit eab1e228c8a2e6e49bb02bdde2d4511ca72e5e2e)
Haoyu Qiu 3 years ago
parent
commit
1722d0cc12
1 changed files with 3 additions and 3 deletions
  1. 3 3
      scene/gui/line_edit.cpp

+ 3 - 3
scene/gui/line_edit.cpp

@@ -1919,9 +1919,6 @@ void LineEdit::_bind_methods() {
 }
 
 LineEdit::LineEdit() {
-
-	undo_stack_pos = NULL;
-	_create_undo_state();
 	align = ALIGN_LEFT;
 	cached_width = 0;
 	cached_placeholder_width = 0;
@@ -1939,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);