Make glue generation shutdown more graceful

(cherry picked from commit 23907e6f19)
This commit is contained in:
Pedro J. Estébanez 2021-02-22 11:06:33 +01:00 committed by Rémi Verschelde
parent 65528a63fb
commit 6f4f49c1d5
3 changed files with 8 additions and 4 deletions

View file

@ -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() {
void Main::cleanup(bool p_force) {
if (!p_force) {
ERR_FAIL_COND(!_start_success);
}
if (script_debugger) {
// Flush any remaining messages

View file

@ -56,7 +56,7 @@ public:
static bool is_iterating();
static void cleanup();
static void cleanup(bool p_force = false);
};
#endif // MAIN_H

View file

@ -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<String> &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<String> &p_cmdline_args)
}
// Exit once done
Main::cleanup(true);
::exit(0);
}
}