Skip to content

Commit 694a264

Browse files
authored
Merge pull request #2060 from agoaj/master
Fix for hot reload crash
2 parents 58d7302 + 79c37b2 commit 694a264

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎include/godot_cpp/core/class_db.hpp‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,9 @@ class ClassDB {
137137
if constexpr (!std::is_abstract_v<T>) {
138138
#ifdef HOT_RELOAD_ENABLED
139139
Wrapped::_get_construct_info().recreate_owner = obj;
140-
T *new_instance = (T *)memalloc(sizeof(T));
141-
memnew_placement(new_instance, T);
140+
Wrapped::_set_construct_info<T>();
141+
T *new_instance = new (memalloc(sizeof(T))) T;
142+
new_instance->_postinitialize();
142143
return new_instance;
143144
#else
144145
return nullptr;

0 commit comments

Comments
 (0)