From 37abbe0c093b5c145041e19588a8c562dbd074fb Mon Sep 17 00:00:00 2001 From: karroffel Date: Fri, 30 Mar 2018 21:41:55 +0200 Subject: [PATCH] fix free() crash with custom resources --- include/core/Godot.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/core/Godot.hpp b/include/core/Godot.hpp index 5ff38b81..933a77a4 100644 --- a/include/core/Godot.hpp +++ b/include/core/Godot.hpp @@ -37,7 +37,7 @@ T *get_wrapper(godot_object *obj) #define GODOT_CLASS(Name, Base) \ public: inline static const char *___get_type_name() { return static_cast(#Name); } \ - inline static Name *_new() { godot::NativeScript *script = godot::NativeScript::_new(); script->set_library(godot::get_wrapper((godot_object *) godot::gdnlib)); script->set_class_name(#Name); Name *instance = godot::as(script->new_()); script->free(); return instance; } \ + inline static Name *_new() { godot::NativeScript *script = godot::NativeScript::_new(); script->set_library(godot::get_wrapper((godot_object *) godot::gdnlib)); script->set_class_name(#Name); Name *instance = godot::as(script->new_()); return instance; } \ inline static const char *___get_base_type_name() { return Base::___get_class_name(); } \ inline static Object *___get_from_variant(godot::Variant a) { return (godot::Object *) godot::as(godot::Object::___get_from_variant(a)); } \ private: