From f2ad7c5f127d744b1b34c0a7dcd423426d3503ea Mon Sep 17 00:00:00 2001 From: Michael Alexsander Date: Wed, 24 Feb 2021 18:34:14 -0300 Subject: Fix heap-use-after-free in Import Defaults Editor --- editor/import_defaults_editor.cpp | 7 ++++++- editor/import_defaults_editor.h | 1 + editor/shader_globals_editor.cpp | 3 --- 3 files changed, 7 insertions(+), 4 deletions(-) (limited to 'editor') diff --git a/editor/import_defaults_editor.cpp b/editor/import_defaults_editor.cpp index 28c595614f..43b97eb910 100644 --- a/editor/import_defaults_editor.cpp +++ b/editor/import_defaults_editor.cpp @@ -69,6 +69,12 @@ protected: } }; +void ImportDefaultsEditor::_notification(int p_what) { + if (p_what == NOTIFICATION_PREDELETE) { + inspector->edit(nullptr); + } +} + void ImportDefaultsEditor::_reset() { if (settings->importer.is_valid()) { settings->values = settings->default_values; @@ -206,6 +212,5 @@ ImportDefaultsEditor::ImportDefaultsEditor() { } ImportDefaultsEditor::~ImportDefaultsEditor() { - inspector->edit(nullptr); memdelete(settings); } diff --git a/editor/import_defaults_editor.h b/editor/import_defaults_editor.h index ff85a25b00..c1becac5e9 100644 --- a/editor/import_defaults_editor.h +++ b/editor/import_defaults_editor.h @@ -62,6 +62,7 @@ class ImportDefaultsEditor : public VBoxContainer { void _save(); protected: + void _notification(int p_what); static void _bind_methods(); public: diff --git a/editor/shader_globals_editor.cpp b/editor/shader_globals_editor.cpp index a61b4aa3b9..ebef5be9ed 100644 --- a/editor/shader_globals_editor.cpp +++ b/editor/shader_globals_editor.cpp @@ -483,8 +483,5 @@ ShaderGlobalsEditor::ShaderGlobalsEditor() { } ShaderGlobalsEditor::~ShaderGlobalsEditor() { - if (is_visible_in_tree()) { - inspector->edit(nullptr); - } memdelete(interface); } -- cgit v1.2.3