summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-12-23 09:20:57 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-12-23 09:20:57 +0100
commitb31bf1f823c38049c99006cf1a3d0192e0c6a4b1 (patch)
tree7d71cbea0f30d9d04695e02bbc1350ddb5d4b0f3 /editor
parentedfa1e8665564da54bd0090283e5b6c671b70983 (diff)
parent176cb9cc8323716a0c78606ffe90292e5d32ca12 (diff)
Merge pull request #70277 from rune-scape/picker-regression
Fix resource picker regression
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_data.cpp5
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;
}