Destroy AudioServer after other non-core types are unregistered

This is important for some GDNative bindings and probably for Mono. They
may keep references to audio objects which are freed when they are
unregistered. If AudioServer is already deleted at that point, it causes
segfaults.
This commit is contained in:
Ruslan Mustakov 2018-01-11 17:01:35 +07:00
parent 554e95747c
commit 5092098947
1 changed files with 5 additions and 5 deletions

View File

@ -1845,11 +1845,6 @@ void Main::cleanup() {
EditorNode::unregister_editor_types();
#endif
if (audio_server) {
audio_server->finish();
memdelete(audio_server);
}
if (arvr_server) {
// cleanup now before we pull the rug from underneath...
memdelete(arvr_server);
@ -1861,6 +1856,11 @@ void Main::cleanup() {
unregister_scene_types();
unregister_server_types();
if (audio_server) {
audio_server->finish();
memdelete(audio_server);
}
OS::get_singleton()->finalize();
finalize_physics();