File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1608,6 +1608,11 @@ void AudioServer::update() {
16081608 for (CallbackItem *ci : update_callback_list) {
16091609 ci->callback (ci->userdata );
16101610 }
1611+
1612+ _cleanup_lists ();
1613+ }
1614+
1615+ void AudioServer::_cleanup_lists () {
16111616 mix_callback_list.maybe_cleanup ();
16121617 update_callback_list.maybe_cleanup ();
16131618 listener_changed_callback_list.maybe_cleanup ();
@@ -2124,6 +2129,10 @@ AudioServer::AudioServer() {
21242129}
21252130
21262131AudioServer::~AudioServer () {
2132+ // Cleanup resources while we still have an active AudioServer singleton,
2133+ // for resources that depend on the singleton still existing.
2134+ _cleanup_lists ();
2135+
21272136 singleton = nullptr ;
21282137}
21292138
Original file line number Diff line number Diff line change @@ -315,6 +315,8 @@ class AudioServer : public Object {
315315 void _delete_stream_playback (Ref<AudioStreamPlayback> p_playback);
316316 void _delete_stream_playback_list_node (AudioStreamPlaybackListNode *p_node);
317317
318+ void _cleanup_lists ();
319+
318320 // TODO document if this is necessary.
319321 SafeList<AudioStreamPlaybackBusDetails *> bus_details_graveyard_frame_old;
320322
You can’t perform that action at this time.
0 commit comments