diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-10-06 08:55:42 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-10-06 08:55:42 +0200 |
commit | a47f9bd53aa66b6a4a3150e1910456aec463e3df (patch) | |
tree | 9c92e594860fcdf2fd769f2bde1b5f8c32511124 /core/object | |
parent | ea9bb98f26be8212245f6ff796617901a8b9f3f6 (diff) | |
parent | 0863cf96e462a3b0d4e0ef023b7238604cc149cd (diff) |
Merge pull request #66687 from Waridley/free_gdn_method_binds
free NativeExtensionMethodBinds on unregister
Diffstat (limited to 'core/object')
-rw-r--r-- | core/object/class_db.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/object/class_db.cpp b/core/object/class_db.cpp index 99b20560da..ca56add2ab 100644 --- a/core/object/class_db.cpp +++ b/core/object/class_db.cpp @@ -1538,7 +1538,11 @@ void ClassDB::register_extension_class(ObjectNativeExtension *p_extension) { } void ClassDB::unregister_extension_class(const StringName &p_class) { - ERR_FAIL_COND(!classes.has(p_class)); + ClassInfo *c = classes.getptr(p_class); + ERR_FAIL_COND_MSG(!c, "Class " + p_class + "does not exist"); + for (KeyValue<StringName, MethodBind *> &F : c->method_map) { + memdelete(F.value); + } classes.erase(p_class); } |