aboutsummaryrefslogtreecommitdiffhomepage
path: root/win32/ScintillaWin.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2014-05-31 09:59:44 +1000
committerNeil <nyamatongwe@gmail.com>2014-05-31 09:59:44 +1000
commite8891bcd3711bcb93f049d8115c3ec56a35a7347 (patch)
treece9f5c2cadcbb15907b72cfdc7160fde4766f3c1 /win32/ScintillaWin.cxx
parent8eea3418fcb2e24f1e666b40b669029a4bcc4135 (diff)
parent5c4efef3606ad493f1e75a9a13dc3c360eee74d4 (diff)
downloadscintilla-mirror-e8891bcd3711bcb93f049d8115c3ec56a35a7347.tar.gz
Merge with 343-Win32-Fix.
Diffstat (limited to 'win32/ScintillaWin.cxx')
-rw-r--r--win32/ScintillaWin.cxx16
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;
}