Merge pull request #46399 from YeldhamDev/import_defaults_another_fix

Fix heap-use-after-free in Import Defaults Editor
This commit is contained in:
Rémi Verschelde 2021-02-25 16:05:28 +01:00 committed by GitHub
commit 369dffc217
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 4 deletions

View file

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

View file

@ -62,6 +62,7 @@ class ImportDefaultsEditor : public VBoxContainer {
void _save();
protected:
void _notification(int p_what);
static void _bind_methods();
public:

View file

@ -483,8 +483,5 @@ ShaderGlobalsEditor::ShaderGlobalsEditor() {
}
ShaderGlobalsEditor::~ShaderGlobalsEditor() {
if (is_visible_in_tree()) {
inspector->edit(nullptr);
}
memdelete(interface);
}