summaryrefslogtreecommitdiff
path: root/sal/osl
diff options
context:
space:
mode:
Diffstat (limited to 'sal/osl')
-rw-r--r--sal/osl/w32/dllentry.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/sal/osl/w32/dllentry.cxx b/sal/osl/w32/dllentry.cxx
index 8e8c0feda62c..e9323248e3db 100644
--- a/sal/osl/w32/dllentry.cxx
+++ b/sal/osl/w32/dllentry.cxx
@@ -221,13 +221,17 @@ BOOL WINAPI DllMain( HINSTANCE, DWORD fdwReason, LPVOID )
{
// No error check, it works or it does not
// Thread should only be started for headless mode, see desktop/win32/source/officeloader.cxx
- CreateThread( nullptr, 0, ParentMonitorThreadProc, reinterpret_cast<LPVOID>(dwParentProcessId), 0, &dwThreadId );
+ HANDLE hThread
+ = CreateThread(nullptr, 0, ParentMonitorThreadProc,
+ reinterpret_cast<LPVOID>(dwParentProcessId), 0, &dwThreadId);
// Note: calling CreateThread in DllMain is discouraged
// but this is only done in the headless mode and in
// that case no other threads should be running at startup
// when sal3.dll is loaded; also there is no
// synchronization with the spawned thread, so there
// does not appear to be a real risk of deadlock here
+ if (hThread)
+ CloseHandle(hThread);
}
}