Skip to content

Commit

Permalink
Merge pull request #90449 from dsnopek/gdextension-hot-reload-not-cla…
Browse files Browse the repository at this point in the history
…ssdb-instantiate-4.2

[4.2] Fix GDExtension hot reload for classes not created via `ClassDB::instantiate()`
  • Loading branch information
akien-mga authored Apr 19, 2024
2 parents c8356fb + be64b0d commit 2d93cb5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions core/object/class_db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,13 +366,7 @@ Object *ClassDB::instantiate(const StringName &p_class) {
}
#endif
if (ti->gdextension && ti->gdextension->create_instance) {
Object *obj = (Object *)ti->gdextension->create_instance(ti->gdextension->class_userdata);
#ifdef TOOLS_ENABLED
if (ti->gdextension->track_instance) {
ti->gdextension->track_instance(ti->gdextension->tracking_userdata, obj);
}
#endif
return obj;
return (Object *)ti->gdextension->create_instance(ti->gdextension->class_userdata);
} else {
return ti->creation_func();
}
Expand All @@ -396,6 +390,12 @@ void ClassDB::set_object_extension_instance(Object *p_object, const StringName &

p_object->_extension = ti->gdextension;
p_object->_extension_instance = p_instance;

#ifdef TOOLS_ENABLED
if (p_object->_extension->track_instance) {
p_object->_extension->track_instance(p_object->_extension->tracking_userdata, p_object);
}
#endif
}

bool ClassDB::can_instantiate(const StringName &p_class) {
Expand Down

0 comments on commit 2d93cb5

Please sign in to comment.