summaryrefslogtreecommitdiff
path: root/libs/mTextControl
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-04-13 13:01:37 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-04-13 13:01:37 +0300
commit833592d193af4a524399bd46a24711b8f5e23ae8 (patch)
tree9c3aa6a2fbf49953198172fe12a814d5bd00d698 /libs/mTextControl
parentcfca11de2e3a5e4cad5fbfe1e0fb199fef961448 (diff)
fixes #2299 (NewStory: падение после попытки вгрузить плагин "на лету" и посмотреть историю)
Diffstat (limited to 'libs/mTextControl')
-rw-r--r--libs/mTextControl/src/main.cpp6
-rw-r--r--libs/mTextControl/src/richeditutils.cpp8
-rw-r--r--libs/mTextControl/src/textcontrol.cpp7
3 files changed, 19 insertions, 2 deletions
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)