From d07eff4fb66e8484a03514ea1725f4feb2004519 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 19 Dec 2023 18:44:33 +0300 Subject: =?UTF-8?q?fixes=20#4057=20(SmileyAdd=20=D0=BF=D1=8B=D1=82=D0=B0?= =?UTF-8?q?=D0=B5=D1=82=D1=81=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0?= =?UTF-8?q?=D1=82=D1=8C=20=D1=81=20=D0=B6=D1=83=D1=80=D0=BD=D0=B0=D0=BB?= =?UTF-8?q?=D0=BE=D0=BC=20NewStory,=20=D0=BA=D0=B0=D0=BA=20=D1=81=20RTF)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/SmileyAdd/src/dlgboxsubclass.cpp | 19 +++++++++++++------ plugins/SmileyAdd/src/richcall.cpp | 4 ++++ 2 files changed, 17 insertions(+), 6 deletions(-) (limited to 'plugins/SmileyAdd/src') diff --git a/plugins/SmileyAdd/src/dlgboxsubclass.cpp b/plugins/SmileyAdd/src/dlgboxsubclass.cpp index 6a560a4127..4f0618b49b 100644 --- a/plugins/SmileyAdd/src/dlgboxsubclass.cpp +++ b/plugins/SmileyAdd/src/dlgboxsubclass.cpp @@ -122,11 +122,21 @@ int SmileyButtonPressed(WPARAM, LPARAM lParam) ///////////////////////////////////////////////////////////////////////////////////////// // window hook +static HWND checkRichEdit(HWND hwnd) +{ + wchar_t wszClass[200]; + if (GetClassNameW(hwnd, wszClass, _countof(wszClass))) + if (!wcsicmp(wszClass, L"RICHEDIT50W")) + return hwnd; + + return nullptr; +} + static int MsgDlgHook(WPARAM uType, LPARAM lParam) { auto *pDlg = (CSrmmBaseDialog *)lParam; - auto hwndLog = pDlg->log()->GetHwnd(); - auto hwndInput = pDlg->GetInput(); + auto hwndLog = checkRichEdit(pDlg->log()->GetHwnd()); + auto hwndInput = checkRichEdit(pDlg->GetInput()); switch (uType) { case MSG_WINDOW_EVT_OPENING: @@ -157,10 +167,7 @@ static int MsgDlgHook(WPARAM uType, LPARAM lParam) break; case MSG_WINDOW_EVT_CLOSE: - if (hwndLog) { - CloseRichCallback(hwndLog); - CloseRichOwnerCallback(pDlg->GetHwnd()); - } + CloseRichOwnerCallback(pDlg->GetHwnd()); mir_cslock lck(csWndList); g_MsgWndList.remove((MsgWndData *)&pDlg); diff --git a/plugins/SmileyAdd/src/richcall.cpp b/plugins/SmileyAdd/src/richcall.cpp index ed0c886ae1..da9323e633 100644 --- a/plugins/SmileyAdd/src/richcall.cpp +++ b/plugins/SmileyAdd/src/richcall.cpp @@ -328,6 +328,9 @@ bool SetRichCallback(HWND hwnd, MCONTACT hContact, bool subany, bool subnew) void CloseRichCallback(HWND hwnd) { + if (!hwnd) + return; + RichEditData *rdt; { mir_cslock lck(csLists); @@ -342,6 +345,7 @@ void CloseRichCallback(HWND hwnd) if (rdt->hToolTip) DestroyWindow(rdt->hToolTip); delete rdt; + mir_unsubclassWindow(hwnd, RichEditSubclass); } -- cgit v1.2.3