浏览代码

Merge pull request #46307 from RandomShaper/fix_crash_mono_glue

Make glue generation shutdown more graceful
Rémi Verschelde 4 年之前
父节点
当前提交
88ee248db0
共有 3 个文件被更改,包括 8 次插入3 次删除
  1. 4 2
      main/main.cpp
  2. 1 1
      main/main.h
  3. 3 0
      modules/mono/editor/bindings_generator.cpp

+ 4 - 2
main/main.cpp

@@ -2576,8 +2576,10 @@ void Main::force_redraw() {
  * so that the engine closes cleanly without leaking memory or crashing.
  * so that the engine closes cleanly without leaking memory or crashing.
  * The order matters as some of those steps are linked with each other.
  * 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);
+	}
 
 
 	EngineDebugger::deinitialize();
 	EngineDebugger::deinitialize();
 
 

+ 1 - 1
main/main.h

@@ -59,7 +59,7 @@ public:
 
 
 	static bool is_iterating();
 	static bool is_iterating();
 
 
-	static void cleanup();
+	static void cleanup(bool p_force = false);
 };
 };
 
 
 // Test main override is for the testing behaviour.
 // Test main override is for the testing behaviour.

+ 3 - 0
modules/mono/editor/bindings_generator.cpp

@@ -39,6 +39,7 @@
 #include "core/os/file_access.h"
 #include "core/os/file_access.h"
 #include "core/os/os.h"
 #include "core/os/os.h"
 #include "core/string/ucaps.h"
 #include "core/string/ucaps.h"
+#include "main/main.h"
 
 
 #include "../glue/cs_glue_version.gen.h"
 #include "../glue/cs_glue_version.gen.h"
 #include "../godotsharp_defs.h"
 #include "../godotsharp_defs.h"
@@ -3649,6 +3650,7 @@ void BindingsGenerator::handle_cmdline_args(const List<String> &p_cmdline_args)
 
 
 		if (!bindings_generator.initialized) {
 		if (!bindings_generator.initialized) {
 			ERR_PRINT("Failed to initialize the bindings generator");
 			ERR_PRINT("Failed to initialize the bindings generator");
+			Main::cleanup(true);
 			::exit(0);
 			::exit(0);
 		}
 		}
 
 
@@ -3675,6 +3677,7 @@ void BindingsGenerator::handle_cmdline_args(const List<String> &p_cmdline_args)
 		}
 		}
 
 
 		// Exit once done
 		// Exit once done
+		Main::cleanup(true);
 		::exit(0);
 		::exit(0);
 	}
 	}
 }
 }