From 833592d193af4a524399bd46a24711b8f5e23ae8 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 13 Apr 2020 13:01:37 +0300 Subject: =?UTF-8?q?fixes=20#2299=20(NewStory:=20=D0=BF=D0=B0=D0=B4=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=BE=D1=81=D0=BB=D0=B5=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BF=D1=8B=D1=82=D0=BA=D0=B8=20=D0=B2=D0=B3=D1=80=D1=83?= =?UTF-8?q?=D0=B7=D0=B8=D1=82=D1=8C=20=D0=BF=D0=BB=D0=B0=D0=B3=D0=B8=D0=BD?= =?UTF-8?q?=20"=D0=BD=D0=B0=20=D0=BB=D0=B5=D1=82=D1=83"=20=D0=B8=20=D0=BF?= =?UTF-8?q?=D0=BE=D1=81=D0=BC=D0=BE=D1=82=D1=80=D0=B5=D1=82=D1=8C=20=D0=B8?= =?UTF-8?q?=D1=81=D1=82=D0=BE=D1=80=D0=B8=D1=8E)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/mTextControl/src/main.cpp | 6 ++++++ libs/mTextControl/src/richeditutils.cpp | 8 +++++++- libs/mTextControl/src/textcontrol.cpp | 7 ++++++- 3 files changed, 19 insertions(+), 2 deletions(-) (limited to 'libs') diff --git a/libs/mTextControl/src/main.cpp b/libs/mTextControl/src/main.cpp index 69a6c06a99..64438a39b1 100644 --- a/libs/mTextControl/src/main.cpp +++ b/libs/mTextControl/src/main.cpp @@ -27,6 +27,9 @@ HINSTANCE g_hInst = nullptr; PCreateTextServices MyCreateTextServices = nullptr; void MTextControl_RegisterClass(); +void MTextControl_UnregisterClass(); + +void DestroyProxyWindow(); ///////////////////////////////////////////////////////////////////////////////////////// @@ -48,6 +51,9 @@ BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD ul_reason_for_call, LPVOID) break; case DLL_PROCESS_DETACH: + DestroyProxyWindow(); + MTextControl_UnregisterClass(); + UnloadTextUsers(); UnloadEmfCache(); FreeLibrary(hMsfteditDll); diff --git a/libs/mTextControl/src/richeditutils.cpp b/libs/mTextControl/src/richeditutils.cpp index c8867eb17a..29f05e17e6 100644 --- a/libs/mTextControl/src/richeditutils.cpp +++ b/libs/mTextControl/src/richeditutils.cpp @@ -131,10 +131,16 @@ HWND CreateProxyWindow(ITextServices *ts) wcl.hCursor = LoadCursor(nullptr, IDC_ARROW); wcl.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH); wcl.lpszClassName = L"NBRichEditProxyWndClass"; - winClass = RegisterClassEx(&wcl); + winClass = RegisterClassExW(&wcl); } HWND hwnd = CreateWindow(L"NBRichEditProxyWndClass", L"", 0, 0, 0, 0, 0, nullptr, nullptr, g_hInst, nullptr); SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)ts); return hwnd; } + +void DestroyProxyWindow() +{ + if (winClass != 0) + UnregisterClassW(L"NBRichEditProxyWndClass", g_hInst); +} \ No newline at end of file diff --git a/libs/mTextControl/src/textcontrol.cpp b/libs/mTextControl/src/textcontrol.cpp index fe4c70ea12..a7069ae88c 100644 --- a/libs/mTextControl/src/textcontrol.cpp +++ b/libs/mTextControl/src/textcontrol.cpp @@ -40,7 +40,12 @@ void MTextControl_RegisterClass() wcl.hCursor = LoadCursor(nullptr, IDC_ARROW); wcl.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH); wcl.lpszClassName = L"MTextControl"; - RegisterClassEx(&wcl); + RegisterClassExW(&wcl); +} + +void MTextControl_UnregisterClass() +{ + UnregisterClassW(L"MTextControl", g_hInst); } LRESULT CALLBACK MTextControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -- cgit v1.2.3