Skip to content

Commit 3135aa5

Browse files
committed
Skip cleanup in DllMain on process termination
1 parent c70ed4a commit 3135aa5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/dll/Main.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ BOOL APIENTRY DllMain(HMODULE aModule, DWORD aReason, LPVOID aReserved)
3636
}
3737
case DLL_PROCESS_DETACH:
3838
{
39+
if (aReserved != nullptr)
40+
{
41+
// DLL is being unloaded due to process termination, skip cleanup.
42+
// https://learn.microsoft.com/en-us/windows/win32/dlls/dllmain
43+
break;
44+
}
45+
3946
try
4047
{
4148
const auto image = Image::Get();

0 commit comments

Comments
 (0)