From d5122ab31cea2364d7914a796572d457eac025ed Mon Sep 17 00:00:00 2001 From: Ignacio Etcheverry Date: Mon, 13 Jan 2020 21:46:41 +0100 Subject: [PATCH] Sync pending VisualServer commands after ScriptServer finalization This is needed as C# may free resources from the finalizer thread during CSharpLanguage::finish(). Previously this would result in RIDs not being freed. --- main/main.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main/main.cpp b/main/main.cpp index 2f924518441..0ff392978a3 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -2169,6 +2169,9 @@ void Main::cleanup() { ScriptServer::finish_languages(); + // Sync pending commands that may have been queued from a different thread during ScriptServer finalization + VisualServer::get_singleton()->sync(); + #ifdef TOOLS_ENABLED EditorNode::unregister_editor_types(); #endif