summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-10-06 08:55:42 +0200
committerRémi Verschelde <rverschelde@gmail.com>2022-10-06 08:55:42 +0200
commita47f9bd53aa66b6a4a3150e1910456aec463e3df (patch)
tree9c92e594860fcdf2fd769f2bde1b5f8c32511124 /core
parentea9bb98f26be8212245f6ff796617901a8b9f3f6 (diff)
parent0863cf96e462a3b0d4e0ef023b7238604cc149cd (diff)
Merge pull request #66687 from Waridley/free_gdn_method_binds
free NativeExtensionMethodBinds on unregister
Diffstat (limited to 'core')
-rw-r--r--core/object/class_db.cpp6
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);
}