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); } }