diff options
Diffstat (limited to 'win32/ScintillaWin.cxx')
-rw-r--r-- | win32/ScintillaWin.cxx | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index c65600ab4..ddcab290b 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -1916,12 +1916,19 @@ sptr_t PASCAL ScintillaWin::SWndProc( } } -extern HINSTANCE hinstPlatformRes; +extern void Platform_Initialise(void *hInstance); +extern void Platform_Finalise(); -// This function is externally visible so it can be called from container when building statically +// This function is externally visible so it can be called from container when building statically. +// Must be called once only. void Scintilla_RegisterClasses(void *hInstance) { - hinstPlatformRes = reinterpret_cast<HINSTANCE>(hInstance); - ScintillaWin::Register(hinstPlatformRes); + Platform_Initialise(hInstance); + ScintillaWin::Register(reinterpret_cast<HINSTANCE>(hInstance)); +} + +// This function is externally visible so it can be called from container when building statically. +void Scintilla_ReleaseResources() { + Platform_Finalise(); } #ifndef STATIC_BUILD @@ -1929,6 +1936,8 @@ extern "C" int APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID) { //Platform::DebugPrintf("Scintilla::DllMain %d %d\n", hInstance, dwReason); if (dwReason == DLL_PROCESS_ATTACH) { Scintilla_RegisterClasses(hInstance); + } else if (dwReason == DLL_PROCESS_DETACH) { + Scintilla_ReleaseResources(); } return TRUE; } |