diff options
| author | Neil <nyamatongwe@gmail.com> | 2014-05-31 09:59:44 +1000 |
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2014-05-31 09:59:44 +1000 |
| commit | 79948de49ae85c62b48ca371a8784effcf774141 (patch) | |
| tree | 64c541e9dcb42c9999759ab7dd40d67c72749b9a /win32/ScintillaWin.cxx | |
| parent | 8b447b76bbc110e055a0637657f5f00c65cc98dd (diff) | |
| parent | 9bc61b338dfe63d2e6fcc66bc0933a0de6bcd31b (diff) | |
| download | scintilla-mirror-79948de49ae85c62b48ca371a8784effcf774141.tar.gz | |
Merge with 343-Win32-Fix.
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 a83c92ef6..c3a6beefb 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -2909,25 +2909,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; } |
