From cddaf50ff814c2633a310eec1f1e716ddd4170b5 Mon Sep 17 00:00:00 2001 From: Mikael Hermansson Date: Mon, 10 Oct 2022 23:29:04 +0200 Subject: [PATCH] Fix use-after-free when deleting objects from extension terminator --- src/godot.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/godot.cpp b/src/godot.cpp index 7e7f2eb3..356e7f19 100644 --- a/src/godot.cpp +++ b/src/godot.cpp @@ -79,11 +79,12 @@ void GDExtensionBinding::initialize_level(void *userdata, GDNativeInitialization void GDExtensionBinding::deinitialize_level(void *userdata, GDNativeInitializationLevel p_level) { ClassDB::current_level = p_level; - ClassDB::deinitialize(p_level); if (terminate_callback) { terminate_callback(static_cast(p_level)); } + + ClassDB::deinitialize(p_level); } void GDExtensionBinding::InitObject::register_initializer(Callback p_init) const {