diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp index a08733de879..8b14a5a8a73 100644 --- a/servers/audio_server.cpp +++ b/servers/audio_server.cpp @@ -892,15 +892,15 @@ void AudioServer::load_default_bus_layout() { void AudioServer::finish() { + for (int i = 0; i < AudioDriverManager::get_driver_count(); i++) { + AudioDriverManager::get_driver(i)->finish(); + } + for (int i = 0; i < buses.size(); i++) { memdelete(buses[i]); } buses.clear(); - - for (int i = 0; i < AudioDriverManager::get_driver_count(); i++) { - AudioDriverManager::get_driver(i)->finish(); - } } void AudioServer::update() {