summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2019-05-31 10:17:19 +0200
committerGitHub <noreply@github.com>2019-05-31 10:17:19 +0200
commit710827c5dbc499c45df90c600540be6fcb781b1e (patch)
tree7f3f31fdf6081d77c0d70b80b457a847e781db75
parent0fc6b86797a8aefad9f9787110211d6a145518b1 (diff)
parent392f6f89cd700351784b27993c65cb0a4d1b759b (diff)
Merge pull request #29324 from qarmin/fix_memory_leak_text_editor
Fix memory leak in Text Editor and FileSystem dock
-rw-r--r--editor/code_editor.cpp16
-rw-r--r--editor/filesystem_dock.cpp2
2 files changed, 10 insertions, 8 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 695560ca34..33adb33c8c 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -675,14 +675,14 @@ void CodeTextEditor::_line_col_changed() {
}
}
- StringBuilder *sb = memnew(StringBuilder);
- sb->append("(");
- sb->append(itos(text_editor->cursor_get_line() + 1).lpad(3));
- sb->append(",");
- sb->append(itos(positional_column + 1).lpad(3));
- sb->append(")");
-
- line_and_col_txt->set_text(sb->as_string());
+ StringBuilder sb;
+ sb.append("(");
+ sb.append(itos(text_editor->cursor_get_line() + 1).lpad(3));
+ sb.append(",");
+ sb.append(itos(positional_column + 1).lpad(3));
+ sb.append(")");
+
+ line_and_col_txt->set_text(sb.as_string());
}
void CodeTextEditor::_text_changed() {
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index 194a131095..6a4d9fea0c 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -451,9 +451,11 @@ void FileSystemDock::_navigate_to_path(const String &p_path, bool p_select_in_fa
} else if (dirAccess->dir_exists(p_path)) {
path = target_path + "/";
} else {
+ memdelete(dirAccess);
ERR_EXPLAIN(vformat(TTR("Cannot navigate to '%s' as it has not been found in the file system!"), p_path));
ERR_FAIL();
}
+ memdelete(dirAccess);
}
_set_current_path_text(path);