diff options
Diffstat (limited to 'plugins/SmileyAdd/src')
| -rw-r--r-- | plugins/SmileyAdd/src/dlgboxsubclass.cpp | 19 | ||||
| -rw-r--r-- | plugins/SmileyAdd/src/richcall.cpp | 4 | 
2 files changed, 17 insertions, 6 deletions
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);
  }
  | 
