diff options
author | rune-scape <allie.smith.epic@gmail.com> | 2022-12-18 19:19:24 -0500 |
---|---|---|
committer | rune-scape <allie.smith.epic@gmail.com> | 2022-12-18 19:59:33 -0500 |
commit | 176cb9cc8323716a0c78606ffe90292e5d32ca12 (patch) | |
tree | 18faec191a2da520809c7003e3e5da43602b0083 /editor/editor_data.cpp | |
parent | 0bb94df247a0a0c22333e2e99744fc3fd184601a (diff) | |
download | redot-engine-176cb9cc8323716a0c78606ffe90292e5d32ca12.tar.gz |
Fix resource picker regression
Diffstat (limited to 'editor/editor_data.cpp')
-rw-r--r-- | editor/editor_data.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index f15b874c45..e593d652ad 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -947,9 +947,10 @@ Variant EditorData::script_class_instance(const String &p_class) { if (ScriptServer::is_global_class(p_class)) { Ref<Script> script = script_class_load_script(p_class); if (script.is_valid()) { - Object *obj = ClassDB::instantiate(script->get_instance_base_type()); + // Store in a variant to initialize the refcount if needed. + Variant obj = ClassDB::instantiate(script->get_instance_base_type()); if (obj) { - obj->set_script(script); + obj.operator Object *()->set_script(script); } return obj; } |