From 6f4f49c1d5d296349e7ad2af4743a03c8d0ae103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20J=2E=20Est=C3=A9banez?= Date: Mon, 22 Feb 2021 11:06:33 +0100 Subject: [PATCH] Make glue generation shutdown more graceful (cherry picked from commit 23907e6f193636c4907d0ccdb9a886fff63ab275) --- main/main.cpp | 7 ++++--- main/main.h | 2 +- modules/mono/editor/bindings_generator.cpp | 3 +++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/main/main.cpp b/main/main.cpp index 0c60cc780ba..d9ce57dd26c 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -2206,9 +2206,10 @@ void Main::force_redraw() { * so that the engine closes cleanly without leaking memory or crashing. * The order matters as some of those steps are linked with each other. */ -void Main::cleanup() { - - ERR_FAIL_COND(!_start_success); +void Main::cleanup(bool p_force) { + if (!p_force) { + ERR_FAIL_COND(!_start_success); + } if (script_debugger) { // Flush any remaining messages diff --git a/main/main.h b/main/main.h index 4f99f2abcb5..06e88fd37aa 100644 --- a/main/main.h +++ b/main/main.h @@ -56,7 +56,7 @@ public: static bool is_iterating(); - static void cleanup(); + static void cleanup(bool p_force = false); }; #endif // MAIN_H diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index 9d870d47fbf..85ee1fdb594 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -39,6 +39,7 @@ #include "core/os/file_access.h" #include "core/os/os.h" #include "core/ucaps.h" +#include "main/main.h" #include "../glue/cs_glue_version.gen.h" #include "../godotsharp_defs.h" @@ -3126,6 +3127,7 @@ void BindingsGenerator::handle_cmdline_args(const List &p_cmdline_args) if (!bindings_generator.initialized) { ERR_PRINTS("Failed to initialize the bindings generator"); + Main::cleanup(true); ::exit(0); } @@ -3148,6 +3150,7 @@ void BindingsGenerator::handle_cmdline_args(const List &p_cmdline_args) } // Exit once done + Main::cleanup(true); ::exit(0); } }