Molecular Modeling Software
リビジョン | 8ded41bb98068c5f49cdf0f3a652df041dbf1e4a (tree) |
---|---|
日時 | 2022-01-25 00:13:07 |
作者 | Toshi Nagata <alchemist.2005@nift...> |
コミッター | Toshi Nagata |
The batch mode crashes if Ruby exception was raised. Fixed.
@@ -200,12 +200,20 @@ bool MyApp::Initialize(int& argc, wxChar **argv) | ||
200 | 200 | { |
201 | 201 | // Called with a batch mode? |
202 | 202 | if (argc > 1 && wcscmp(argv[1], L"-b") == 0) { |
203 | + | |
204 | + // Disable any wxLog functionality (otherwise ::exit() may crash) | |
205 | + wxLog::EnableLogging(false); | |
206 | + | |
203 | 207 | gUseGUI = 0; |
204 | 208 | gSuppressConsole = 1; |
205 | 209 | |
206 | 210 | if (argc > 2 && wcscmp(argv[2], L"-v") == 0) |
207 | 211 | gSuppressConsole = 0; |
208 | - | |
212 | + | |
213 | + // We need these parameters in FindResourcePath(), so we assign them here | |
214 | + this->argc = argc; | |
215 | + this->argv = argv; | |
216 | + | |
209 | 217 | static const char fname[] = "startup.rb"; |
210 | 218 | wxString dirname = FindResourcePath(); |
211 | 219 |
@@ -246,9 +254,9 @@ bool MyApp::Initialize(int& argc, wxChar **argv) | ||
246 | 254 | } |
247 | 255 | if (status != 0) { |
248 | 256 | Ruby_showError(status); |
249 | - ::exit(1); | |
250 | 257 | } |
251 | - ::exit(0); | |
258 | + // Force exit | |
259 | + ::exit(status); | |
252 | 260 | } else { |
253 | 261 | // Call the inherited version |
254 | 262 | return wxApp::Initialize(argc, argv); |