Pārlūkot izejas kodu

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.
Ruslan Mustakov 7 gadi atpakaļ
vecāks
revīzija
5092098947
1 mainītis faili ar 5 papildinājumiem un 5 dzēšanām
  1. 5 5
      main/main.cpp

+ 5 - 5
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();