Ver Fonte

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 há 7 anos atrás
pai
commit
5092098947
1 ficheiros alterados com 5 adições e 5 exclusões
  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();