From fd6a4772446bae01aaaf5a9cb896bf4580c3c433 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Tue, 12 Feb 2002 10:33:20 +0000 Subject: Made font cache thread safe by using a critical section. --- win32/ScintillaWin.cxx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'win32/ScintillaWin.cxx') 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); - ScintillaWin::Register(hinstPlatformRes); + Platform_Initialise(hInstance); + ScintillaWin::Register(reinterpret_cast(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; } -- cgit v1.2.3