From 0863cf96e462a3b0d4e0ef023b7238604cc149cd Mon Sep 17 00:00:00 2001 From: Waridley Date: Wed, 5 Oct 2022 11:46:00 -0500 Subject: [PATCH] free NativeExtensionMethodBinds on unregister --- core/object/class_db.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/object/class_db.cpp b/core/object/class_db.cpp index 99b20560da7..ca56add2abb 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 &F : c->method_map) { + memdelete(F.value); + } classes.erase(p_class); }