@@ -42,6 +42,10 @@ namespace godot {
42
42
thread_local const StringName *Wrapped::_constructing_extension_class_name = nullptr ;
43
43
thread_local const GDExtensionInstanceBindingCallbacks *Wrapped::_constructing_class_binding_callbacks = nullptr ;
44
44
45
+ #ifdef HOT_RELOAD_ENABLED
46
+ thread_local GDExtensionObjectPtr Wrapped::_constructing_recreate_owner = nullptr ;
47
+ #endif
48
+
45
49
const StringName *Wrapped::_get_extension_class_name () {
46
50
return nullptr ;
47
51
}
@@ -55,25 +59,14 @@ void Wrapped::_postinitialize() {
55
59
56
60
Wrapped::Wrapped (const StringName p_godot_class) {
57
61
#ifdef HOT_RELOAD_ENABLED
58
- if (unlikely (Wrapped::recreate_instance)) {
59
- RecreateInstance *recreate_data = Wrapped::recreate_instance;
60
- RecreateInstance *previous = nullptr ;
61
- while (recreate_data) {
62
- if (recreate_data->wrapper == this ) {
63
- _owner = recreate_data->owner ;
64
- if (previous) {
65
- previous->next = recreate_data->next ;
66
- } else {
67
- Wrapped::recreate_instance = recreate_data->next ;
68
- }
69
- return ;
70
- }
71
- previous = recreate_data;
72
- recreate_data = recreate_data->next ;
73
- }
74
- }
62
+ if (unlikely (Wrapped::_constructing_recreate_owner)) {
63
+ _owner = Wrapped::_constructing_recreate_owner;
64
+ Wrapped::_constructing_recreate_owner = nullptr ;
65
+ } else
75
66
#endif
76
- _owner = godot::internal::gdextension_interface_classdb_construct_object (reinterpret_cast <GDExtensionConstStringNamePtr>(p_godot_class._native_ptr ()));
67
+ {
68
+ _owner = godot::internal::gdextension_interface_classdb_construct_object (reinterpret_cast <GDExtensionConstStringNamePtr>(p_godot_class._native_ptr ()));
69
+ }
77
70
78
71
if (_constructing_extension_class_name) {
79
72
godot::internal::gdextension_interface_object_set_instance (_owner, reinterpret_cast <GDExtensionConstStringNamePtr>(_constructing_extension_class_name), this );
0 commit comments