diff options
| author | Neil <nyamatongwe@gmail.com> | 2014-05-26 11:33:26 +1000 |
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2014-05-26 11:33:26 +1000 |
| commit | 13ca9b24585d296a5db435621c919e096c9b03e4 (patch) | |
| tree | c43a4bbec468cb530a897235d14ec203e67cc64d /win32/ScintillaWin.cxx | |
| parent | eebc2ecd2176edd02bce5d6acdbb9c289fbd378d (diff) | |
| download | scintilla-mirror-13ca9b24585d296a5db435621c919e096c9b03e4.tar.gz | |
Bug [#1602]. Bug [#1603]. Fix hangs and crashes at shutdown.
Diffstat (limited to 'win32/ScintillaWin.cxx')
| -rw-r--r-- | win32/ScintillaWin.cxx | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 762960685..d4f0415e8 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -2907,25 +2907,31 @@ int Scintilla_RegisterClasses(void *hInstance) { return result; } -// This function is externally visible so it can be called from container when building statically. -int Scintilla_ReleaseResources() { +static int ResourcesRelease(bool fromDllMain) { bool result = ScintillaWin::Unregister(); if (commctrl32) { FreeLibrary(commctrl32); commctrl32 = NULL; } - Platform_Finalise(); + Platform_Finalise(fromDllMain); return result; } +// This function is externally visible so it can be called from container when building statically. +int Scintilla_ReleaseResources() { + return ResourcesRelease(false); +} + #ifndef STATIC_BUILD -extern "C" int APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID) { +extern "C" int APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpvReserved) { //Platform::DebugPrintf("Scintilla::DllMain %d %d\n", hInstance, dwReason); if (dwReason == DLL_PROCESS_ATTACH) { if (!Scintilla_RegisterClasses(hInstance)) return FALSE; } else if (dwReason == DLL_PROCESS_DETACH) { - Scintilla_ReleaseResources(); + if (lpvReserved == NULL) { + ResourcesRelease(true); + } } return TRUE; } |
