| 1483 | |
| 1484 | |
| 1485 | void Script::TerminateApp(ExitReasons aExitReason, int aExitCode) |
| 1486 | // Note that g_script's destructor takes care of most other cleanup work, such as destroying |
| 1487 | // tray icons, menus, and unowned windows such as ToolTip. |
| 1488 | { |
| 1489 | // L31: Release objects stored in variables, where possible. |
| 1490 | if (aExitReason != EXIT_CRITICAL) // i.e. Avoid making matters worse if EXIT_CRITICAL. |
| 1491 | { |
| 1492 | // Ensure the current thread is not paused and can't be interrupted |
| 1493 | // in case one or more objects need to call a __delete meta-function. |
| 1494 | g_AllowInterruption = FALSE; |
| 1495 | g->IsPaused = false; |
| 1496 | |
| 1497 | ReleaseVarObjects(mVars); |
| 1498 | ReleaseStaticVarObjects(mFuncs); |
| 1499 | } |
| 1500 | #ifdef CONFIG_DEBUGGER // L34: Exit debugger *after* the above to allow debugging of any invoked __Delete handlers. |
| 1501 | g_Debugger.Exit(aExitReason); |
| 1502 | #endif |
| 1503 | |
| 1504 | // We call DestroyWindow() because MainWindowProc() has left that up to us. |
| 1505 | // DestroyWindow() will cause MainWindowProc() to immediately receive and process the |
| 1506 | // WM_DESTROY msg, which should in turn result in any child windows being destroyed |
| 1507 | // and other cleanup being done: |
| 1508 | if (IsWindow(g_hWnd)) // Adds peace of mind in case WM_DESTROY was already received in some unusual way. |
| 1509 | { |
| 1510 | g_DestroyWindowCalled = true; |
| 1511 | DestroyWindow(g_hWnd); |
| 1512 | } |
| 1513 | Hotkey::AllDestructAndExit(aExitCode); |
| 1514 | } |
| 1515 | |
| 1516 | |
| 1517 |
no test coverage detected