diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-02-25 16:05:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-25 16:05:28 +0100 |
commit | 369dffc2179b41477a9baa566ed70b94d14b967a (patch) | |
tree | e8d2dfa25c892dc4b32fa4664f31613b061d141d /editor | |
parent | 68ebcb915e17eac7fb40922545ab644e02138d5a (diff) | |
parent | f2ad7c5f127d744b1b34c0a7dcd423426d3503ea (diff) |
Merge pull request #46399 from YeldhamDev/import_defaults_another_fix
Fix heap-use-after-free in Import Defaults Editor
Diffstat (limited to 'editor')
-rw-r--r-- | editor/import_defaults_editor.cpp | 7 | ||||
-rw-r--r-- | editor/import_defaults_editor.h | 1 | ||||
-rw-r--r-- | editor/shader_globals_editor.cpp | 3 |
3 files changed, 7 insertions, 4 deletions
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); } |