Repository: godot
Issue: Godot leaks a lot of things if started with inexistent scene path in command line
Labels: bug,topic:core,confirmed

Godot 3.2 71a6d2cd17b9b48027a6a36b4e7b8adee0eb373c

I launched Godot with a command line argument so it starts a specific scene. However, the path was wrong, and Godot failed to load it as expected. However, it leaked a bunch of things after that:

```
Godot Engine v3.2.dev.custom_build.71a6d2cd1 - https://godotengine.org
Using GLES3 video driver
OpenGL ES 3.0 Renderer: GeForce GTX 1060 6GB/PCIe/SSE2
WASAPI: wFormatTag = 65534
WASAPI: nChannels = 2
WASAPI: nSamplesPerSec = 48000
WASAPI: nAvgBytesPerSec = 384000
WASAPI: nBlockAlign = 8
WASAPI: wBitsPerSample = 32
WASAPI: cbSize = 22
WASAPI: detected 2 channels
WASAPI: audio buffer frames: 1962 calculated latency: 44ms

Loading resource: res://default_bus_layout.tres
CORE API HASH: -8489505122774148893
EDITOR API HASH: -1606062373362734782
Loading resource: res://default_env.tres
Loading resource: res://ddd.gd
Loaded builtin certs
Loading resource: res://conversion_test/conversion_test.tscn
ERROR: ResourceFormatLoaderText::load_interactive: Condition ' err != OK ' is true. returned: Ref<ResourceInteractiveLoader>()
   At: scene\resources\resource_format_text.cpp:1228
ERROR: Failed loading resource: res://conversion_test/conversion_test.tscn
   At: core\io\resource_loader.cpp:283
ERROR: Failed loading scene: res://conversion_test/conversion_test.tscn
   At: main\main.cpp:1752
ERROR: SelfList<class GDScriptFunction>::List::~List: Condition ' _first != 0 ' is true.
   At: C:\Projects\Godot\Engine\godot_fork\core/self_list.h:111
ERROR: SelfList<class GDScript>::List::~List: Condition ' _first != 0 ' is true.
   At: C:\Projects\Godot\Engine\godot_fork\core/self_list.h:111
WARNING: ObjectDB::cleanup: ObjectDB Instances still exist!
     At: core\object.cpp:2098
Leaked instance: ViewportTexture:1165 - Resource name:  Path:
Leaked instance: Viewport:1162 - Node name: root
Leaked instance: World2D:1163 - Resource name:  Path:
Leaked instance: World:1166 - Resource name:  Path:
Leaked instance: BulletPhysicsDirectSpaceState:1167
Leaked instance: MultiplayerAPI:1168
Leaked instance: Physics2DDirectSpaceStateSW:1164
Leaked instance: Environment:1171 - Resource name:  Path: res://default_env.tres
Leaked instance: GDScriptNativeClass:1054
Leaked instance: ProceduralSky:1170 - Resource name:  Path: res://default_env.tres::1
Leaked instance: SceneTree:1161
Leaked instance: GDScript:1172 - Resource name:  Path: res://ddd.gd
Leaked instance: Node:1173 - Node name: DDD
ERROR: ResourceCache::clear: Resources Still in use at Exit!
   At: core\resource.cpp:445
Orphan StringName: tree_changed
Orphan StringName: draw_line
Orphan StringName: get_frames_drawn
Orphan StringName: _server_disconnected
Orphan StringName: add_child
Orphan StringName: network_peer_connected
Orphan StringName: frame
Orphan StringName: PRIMITIVE_LINES
Orphan StringName: color
Orphan StringName: _texts
Orphan StringName: World2D
Orphan StringName: BulletPhysicsDirectSpaceState
Orphan StringName: _network_peer_connected
Orphan StringName: ProceduralSky
Orphan StringName: _lines
Orphan StringName: _network_peer_disconnected
Orphan StringName: node_added
Orphan StringName: new
Orphan StringName: flags_unshaded
Orphan StringName: GDScriptNativeClass
Orphan StringName: World
Orphan StringName: TEXT_LINGER_FRAMES
Orphan StringName: queue_free
Orphan StringName: Viewport
Orphan StringName: a
Orphan StringName: b
Orphan StringName: network_peer_disconnected
Orphan StringName: LINES_LINGER_FRAMES
Orphan StringName: vertex_color_use_as_albedo
Orphan StringName: node
Orphan StringName: _vp_gui_input1162
Orphan StringName: node_removed
Orphan StringName: _vp_input1162
Orphan StringName: key
Orphan StringName: Physics2DDirectSpaceStateSW
Orphan StringName: begin
Orphan StringName: add_vertex
Orphan StringName: set_color
Orphan StringName: append
Orphan StringName: text
Orphan StringName: pop_back
Orphan StringName: root
Orphan StringName: _vp_unhandled_key_input1162
Orphan StringName: keys
Orphan StringName: MultiplayerAPI
Orphan StringName: material_override
Orphan StringName: erase
Orphan StringName: Environment
Orphan StringName: Node
Orphan StringName: _line_material
Orphan StringName: _get_line_material
Orphan StringName: _connection_failed
Orphan StringName: SceneTree
Orphan StringName: connected_to_server
Orphan StringName: node_renamed
Orphan StringName: _process
Orphan StringName: connection_failed
Orphan StringName: _vp_unhandled_input1162
Orphan StringName: DDD
Orphan StringName: set_text
Orphan StringName: res://ddd.gd
Orphan StringName: _init
Orphan StringName: _label
Orphan StringName: _connected_to_server
Orphan StringName: ViewportTexture
Orphan StringName: GDScript
Orphan StringName: server_disconnected
Orphan StringName: end
Orphan StringName: delta
StringName: 69 unclaimed string names at exit.
```