mirror of https://github.com/godotengine/godot
Fix change_scene memory leak due to duplicate instantiation
Regression from #71105. Fixes #71363.
This commit is contained in:
parent
9711abe787
commit
55bf948fe7
|
|
@ -1134,7 +1134,6 @@ Error SceneTree::change_scene_to_packed(const Ref<PackedScene> &p_scene) {
|
||||||
ERR_FAIL_COND_V_MSG(p_scene.is_null(), ERR_INVALID_PARAMETER, "Can't change to a null scene. Use unload_current_scene() if you wish to unload it.");
|
ERR_FAIL_COND_V_MSG(p_scene.is_null(), ERR_INVALID_PARAMETER, "Can't change to a null scene. Use unload_current_scene() if you wish to unload it.");
|
||||||
|
|
||||||
Node *new_scene = p_scene->instantiate();
|
Node *new_scene = p_scene->instantiate();
|
||||||
new_scene = p_scene->instantiate();
|
|
||||||
ERR_FAIL_COND_V(!new_scene, ERR_CANT_CREATE);
|
ERR_FAIL_COND_V(!new_scene, ERR_CANT_CREATE);
|
||||||
|
|
||||||
call_deferred(SNAME("_change_scene"), new_scene);
|
call_deferred(SNAME("_change_scene"), new_scene);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue