aboutsummaryrefslogtreecommitdiffhomepage
path: root/win32/ScintillaWin.cxx
diff options
context:
space:
mode:
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 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;
}