MCPcopy Create free account
hub / github.com/AutoHotkey/AutoHotkey / TerminateApp

Method TerminateApp

source/script.cpp:1485–1514  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1483
1484
1485void 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

Callers 1

DEBUGGER_COMMANDFunction · 0.80

Calls 3

ReleaseVarObjectsFunction · 0.85
ReleaseStaticVarObjectsFunction · 0.85
ExitMethod · 0.80

Tested by

no test coverage detected