summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorRuslan Mustakov <r.mustakov@gmail.com>2018-01-11 17:01:35 +0700
committerRuslan Mustakov <r.mustakov@gmail.com>2018-01-11 17:03:38 +0700
commit509209894709b3e7c6b10a7d5eae392e06be32bd (patch)
treef71043801817505b91943968819de7cdf29461c6 /main
parent554e95747c07afa893a2c4c0445370dda57aa7d0 (diff)
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.
Diffstat (limited to 'main')
-rw-r--r--main/main.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/main/main.cpp b/main/main.cpp
index 48537dc3a7..0b231b9d30 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -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();