Merge pull request #29324 from qarmin/fix_memory_leak_text_editor

Fix memory leak in Text Editor and FileSystem dock
This commit is contained in:
Rémi Verschelde 2019-05-31 10:17:19 +02:00 committed by GitHub
commit 710827c5db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 7 deletions

View file

@ -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(")");
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());
line_and_col_txt->set_text(sb.as_string());
}
void CodeTextEditor::_text_changed() {

View file

@ -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);