aboutsummaryrefslogtreecommitdiffhomepage
path: root/win32/ScintillaWin.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'win32/ScintillaWin.cxx')
-rw-r--r--win32/ScintillaWin.cxx9
1 files changed, 8 insertions, 1 deletions
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index 0e2308c70..a0372f574 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -125,6 +125,8 @@ class ScintillaWin; // Forward declaration for COM interface subobjects
typedef void VFunction(void);
+static HMODULE commctrl32 = 0;
+
/**
*/
class FormatEnumerator {
@@ -383,7 +385,8 @@ void ScintillaWin::Initialise() {
TrackMouseEventFn = (TrackMouseEventSig)::GetProcAddress(user32, "TrackMouseEvent");
if (TrackMouseEventFn == NULL) {
// Windows 95 has an emulation in comctl32.dll:_TrackMouseEvent
- HMODULE commctrl32 = ::LoadLibrary(TEXT("comctl32.dll"));
+ if (!commctrl32)
+ commctrl32 = ::LoadLibrary(TEXT("comctl32.dll"));
if (commctrl32 != NULL) {
TrackMouseEventFn = (TrackMouseEventSig)
::GetProcAddress(commctrl32, "_TrackMouseEvent");
@@ -2872,6 +2875,10 @@ int Scintilla_RegisterClasses(void *hInstance) {
// This function is externally visible so it can be called from container when building statically.
int Scintilla_ReleaseResources() {
bool result = ScintillaWin::Unregister();
+ if (commctrl32) {
+ FreeLibrary(commctrl32);
+ commctrl32 = NULL;
+ }
Platform_Finalise();
return result;
}