Merge pull request #33516 from qarmin/small_fixes
Memory leaks and crash fixes
This commit is contained in:
commit
2143f46df2
@ -207,6 +207,7 @@ void EditorResourcePreview::_generate_preview(Ref<ImageTexture> &r_texture, Ref<
|
|||||||
f->store_line(itos(has_small_texture));
|
f->store_line(itos(has_small_texture));
|
||||||
f->store_line(itos(FileAccess::get_modified_time(p_item.path)));
|
f->store_line(itos(FileAccess::get_modified_time(p_item.path)));
|
||||||
f->store_line(FileAccess::get_md5(p_item.path));
|
f->store_line(FileAccess::get_md5(p_item.path));
|
||||||
|
f->close();
|
||||||
memdelete(f);
|
memdelete(f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5247,6 +5247,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
|||||||
snap_other_nodes = true;
|
snap_other_nodes = true;
|
||||||
snap_guides = true;
|
snap_guides = true;
|
||||||
snap_rotation = false;
|
snap_rotation = false;
|
||||||
|
snap_scale = false;
|
||||||
snap_relative = false;
|
snap_relative = false;
|
||||||
snap_pixel = false;
|
snap_pixel = false;
|
||||||
snap_target[0] = SNAP_TARGET_NONE;
|
snap_target[0] = SNAP_TARGET_NONE;
|
||||||
|
@ -103,11 +103,13 @@ Ref<Texture> EditorTexturePreviewPlugin::generate(const RES &p_from, const Size2
|
|||||||
img = ltex->to_image();
|
img = ltex->to_image();
|
||||||
} else {
|
} else {
|
||||||
Ref<Texture> tex = p_from;
|
Ref<Texture> tex = p_from;
|
||||||
|
if (tex.is_valid()) {
|
||||||
img = tex->get_data();
|
img = tex->get_data();
|
||||||
if (img.is_valid()) {
|
if (img.is_valid()) {
|
||||||
img = img->duplicate();
|
img = img->duplicate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (img.is_null() || img->empty())
|
if (img.is_null() || img->empty())
|
||||||
return Ref<Texture>();
|
return Ref<Texture>();
|
||||||
|
@ -91,6 +91,8 @@ RES ResourceFormatPKM::load(const String &p_path, const String &p_original_path,
|
|||||||
if (r_error)
|
if (r_error)
|
||||||
*r_error = OK;
|
*r_error = OK;
|
||||||
|
|
||||||
|
f->close();
|
||||||
|
memdelete(f);
|
||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -741,6 +741,8 @@ RES ResourceFormatLoaderTheora::load(const String &p_path, const String &p_origi
|
|||||||
*r_error = OK;
|
*r_error = OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
f->close();
|
||||||
|
memdelete(f);
|
||||||
return ogv_stream;
|
return ogv_stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -484,6 +484,8 @@ RES ResourceFormatLoaderWebm::load(const String &p_path, const String &p_origina
|
|||||||
*r_error = OK;
|
*r_error = OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
f->close();
|
||||||
|
memdelete(f);
|
||||||
return webm_stream;
|
return webm_stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,6 +213,7 @@ void Range::unshare() {
|
|||||||
nshared->val = shared->val;
|
nshared->val = shared->val;
|
||||||
nshared->step = shared->step;
|
nshared->step = shared->step;
|
||||||
nshared->page = shared->page;
|
nshared->page = shared->page;
|
||||||
|
nshared->exp_ratio = shared->exp_ratio;
|
||||||
nshared->allow_greater = shared->allow_greater;
|
nshared->allow_greater = shared->allow_greater;
|
||||||
nshared->allow_lesser = shared->allow_lesser;
|
nshared->allow_lesser = shared->allow_lesser;
|
||||||
_unref_shared();
|
_unref_shared();
|
||||||
|
@ -4049,6 +4049,7 @@ Tree::Tree() {
|
|||||||
drop_mode_section = 0;
|
drop_mode_section = 0;
|
||||||
single_select_defer = NULL;
|
single_select_defer = NULL;
|
||||||
|
|
||||||
|
scrolling = false;
|
||||||
allow_rmb_select = false;
|
allow_rmb_select = false;
|
||||||
force_edit_checkbox_only_on_checkbox = false;
|
force_edit_checkbox_only_on_checkbox = false;
|
||||||
|
|
||||||
|
@ -2369,16 +2369,20 @@ RES ResourceFormatLoaderTextureLayered::load(const String &p_path, const String
|
|||||||
|
|
||||||
if (header[0] == 'G' && header[1] == 'D' && header[2] == '3' && header[3] == 'T') {
|
if (header[0] == 'G' && header[1] == 'D' && header[2] == '3' && header[3] == 'T') {
|
||||||
if (tex3d.is_null()) {
|
if (tex3d.is_null()) {
|
||||||
|
f->close();
|
||||||
memdelete(f);
|
memdelete(f);
|
||||||
ERR_FAIL_COND_V(tex3d.is_null(), RES())
|
ERR_FAIL_COND_V(tex3d.is_null(), RES())
|
||||||
}
|
}
|
||||||
} else if (header[0] == 'G' && header[1] == 'D' && header[2] == 'A' && header[3] == 'T') {
|
} else if (header[0] == 'G' && header[1] == 'D' && header[2] == 'A' && header[3] == 'T') {
|
||||||
if (texarr.is_null()) {
|
if (texarr.is_null()) {
|
||||||
|
f->close();
|
||||||
memdelete(f);
|
memdelete(f);
|
||||||
ERR_FAIL_COND_V(texarr.is_null(), RES())
|
ERR_FAIL_COND_V(texarr.is_null(), RES())
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
f->close();
|
||||||
|
memdelete(f);
|
||||||
ERR_FAIL_V_MSG(RES(), "Unrecognized layered texture file format '" + String((const char *)header) + "'.");
|
ERR_FAIL_V_MSG(RES(), "Unrecognized layered texture file format '" + String((const char *)header) + "'.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2418,6 +2422,7 @@ RES ResourceFormatLoaderTextureLayered::load(const String &p_path, const String
|
|||||||
if (r_error) {
|
if (r_error) {
|
||||||
*r_error = ERR_FILE_CORRUPT;
|
*r_error = ERR_FILE_CORRUPT;
|
||||||
}
|
}
|
||||||
|
f->close();
|
||||||
memdelete(f);
|
memdelete(f);
|
||||||
ERR_FAIL_V(RES());
|
ERR_FAIL_V(RES());
|
||||||
}
|
}
|
||||||
@ -2453,6 +2458,7 @@ RES ResourceFormatLoaderTextureLayered::load(const String &p_path, const String
|
|||||||
if (r_error) {
|
if (r_error) {
|
||||||
*r_error = ERR_FILE_CORRUPT;
|
*r_error = ERR_FILE_CORRUPT;
|
||||||
}
|
}
|
||||||
|
f->close();
|
||||||
memdelete(f);
|
memdelete(f);
|
||||||
ERR_FAIL_V(RES());
|
ERR_FAIL_V(RES());
|
||||||
}
|
}
|
||||||
@ -2473,8 +2479,9 @@ RES ResourceFormatLoaderTextureLayered::load(const String &p_path, const String
|
|||||||
if (bytes != total_size) {
|
if (bytes != total_size) {
|
||||||
if (r_error) {
|
if (r_error) {
|
||||||
*r_error = ERR_FILE_CORRUPT;
|
*r_error = ERR_FILE_CORRUPT;
|
||||||
memdelete(f);
|
|
||||||
}
|
}
|
||||||
|
f->close();
|
||||||
|
memdelete(f);
|
||||||
ERR_FAIL_V(RES());
|
ERR_FAIL_V(RES());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -297,4 +297,5 @@ void AudioEffectRecord::_bind_methods() {
|
|||||||
|
|
||||||
AudioEffectRecord::AudioEffectRecord() {
|
AudioEffectRecord::AudioEffectRecord() {
|
||||||
format = AudioStreamSample::FORMAT_16_BITS;
|
format = AudioStreamSample::FORMAT_16_BITS;
|
||||||
|
recording_active = false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user