From 129dc85ba1c4b2ed1af9b53582c96096b6b54802 Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 26 May 2014 11:33:26 +1000 Subject: Bug [#1602]. Bug [#1603]. Fix hangs and crashes at shutdown. --- win32/PlatWin.cxx | 50 ++++++++++++++++++++++++++------------------------ win32/PlatWin.h | 2 +- win32/ScintillaWin.cxx | 16 +++++++++++----- 3 files changed, 38 insertions(+), 30 deletions(-) (limited to 'win32') diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 082a177e6..507075a77 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -3280,31 +3280,33 @@ void Platform_Initialise(void *hInstance) { #pragma warning(default: 4996) #endif -void Platform_Finalise() { +void Platform_Finalise(bool fromDllMain) { #if defined(USE_D2D) - if (defaultRenderingParams) { - defaultRenderingParams->Release(); - defaultRenderingParams = 0; - } - if (customClearTypeRenderingParams) { - customClearTypeRenderingParams->Release(); - customClearTypeRenderingParams = 0; - } - if (pIDWriteFactory) { - pIDWriteFactory->Release(); - pIDWriteFactory = 0; - } - if (pD2DFactory) { - pD2DFactory->Release(); - pD2DFactory = 0; - } - if (hDLLDWrite) { - FreeLibrary(hDLLDWrite); - hDLLDWrite = NULL; - } - if (hDLLD2D) { - FreeLibrary(hDLLD2D); - hDLLD2D = NULL; + if (!fromDllMain) { + if (defaultRenderingParams) { + defaultRenderingParams->Release(); + defaultRenderingParams = 0; + } + if (customClearTypeRenderingParams) { + customClearTypeRenderingParams->Release(); + customClearTypeRenderingParams = 0; + } + if (pIDWriteFactory) { + pIDWriteFactory->Release(); + pIDWriteFactory = 0; + } + if (pD2DFactory) { + pD2DFactory->Release(); + pD2DFactory = 0; + } + if (hDLLDWrite) { + FreeLibrary(hDLLDWrite); + hDLLDWrite = NULL; + } + if (hDLLD2D) { + FreeLibrary(hDLLD2D); + hDLLD2D = NULL; + } } #endif if (reverseArrowCursor != NULL) diff --git a/win32/PlatWin.h b/win32/PlatWin.h index 93e1d7253..c284d42d3 100644 --- a/win32/PlatWin.h +++ b/win32/PlatWin.h @@ -14,7 +14,7 @@ namespace Scintilla { extern bool IsNT(); extern void Platform_Initialise(void *hInstance); -extern void Platform_Finalise(); +extern void Platform_Finalise(bool fromDllMain); #if defined(USE_D2D) extern bool LoadD2D(); 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; } -- cgit v1.2.3 From f6c82c602edf27a859407f2b26227a55e70e49c7 Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 26 May 2014 11:36:09 +1000 Subject: Updates for 3.4.3 release. --- win32/ScintRes.rc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'win32') diff --git a/win32/ScintRes.rc b/win32/ScintRes.rc index dd1099196..c7ccba757 100644 --- a/win32/ScintRes.rc +++ b/win32/ScintRes.rc @@ -4,8 +4,8 @@ #include -#define VERSION_SCINTILLA "3.4.2" -#define VERSION_WORDS 3, 4, 2, 0 +#define VERSION_SCINTILLA "3.4.3" +#define VERSION_WORDS 3, 4, 3, 0 VS_VERSION_INFO VERSIONINFO FILEVERSION VERSION_WORDS -- cgit v1.2.3