From f52b5cc86d9eff2494902157c8fc0a4e019a3c95 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 15 Aug 2017 13:49:37 +0300 Subject: fixes #799 (Crash on receiving msg in FB group chat) --- src/core/stdmsg/src/msgdialog.cpp | 6 +++--- src/core/stdmsg/src/msgs.cpp | 19 ------------------- src/core/stdmsg/src/msgs.h | 2 +- 3 files changed, 4 insertions(+), 23 deletions(-) (limited to 'src/core/stdmsg') diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 758842535e..7646c4e7ed 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -561,10 +561,10 @@ void CSrmmWindow::SetupStatusBar() SendMessage(m_hwnd, DM_STATUSICONCHANGE, 0, 0); } -void CSrmmWindow::SetStatusData(StatusTextData *st) +void CSrmmWindow::SetStatusText(const wchar_t *wszText, HICON hIcon) { - SendMessage(m_pOwner->m_hwndStatus, SB_SETICON, 0, (LPARAM)(st == nullptr ? 0 : st->hIcon)); - SendMessage(m_pOwner->m_hwndStatus, SB_SETTEXT, 0, (LPARAM)(st == nullptr ? L"" : st->tszText)); + SendMessage(m_pOwner->m_hwndStatus, SB_SETICON, 0, (LPARAM)hIcon); + SendMessage(m_pOwner->m_hwndStatus, SB_SETTEXT, 0, (LPARAM)wszText); } void CSrmmWindow::UpdateReadChars() diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index bffa4588be..6d302f3111 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -479,24 +479,6 @@ static int PrebuildContactMenu(WPARAM hContact, LPARAM) return 0; } -static INT_PTR SetStatusText(WPARAM wParam, LPARAM lParam) -{ - StatusTextData *st = (StatusTextData*)lParam; - if (st == nullptr) - return 1; - - HWND hwnd = Srmm_FindWindow(wParam); - if (hwnd == nullptr) - return 1; - - CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(hwnd, GWLP_USERDATA); - if (dat == nullptr) - return 1; - - dat->SetStatusData(st); - return 0; -} - static wchar_t tszError[] = LPGENW("Miranda could not load the built-in message module, msftedit.dll is missing. Press 'Yes' to continue loading Miranda."); int LoadSendRecvMessageModule(void) @@ -521,7 +503,6 @@ int LoadSendRecvMessageModule(void) CreateServiceFunction(MS_MSG_SENDMESSAGE, SendMessageCommand); CreateServiceFunction(MS_MSG_SENDMESSAGEW, SendMessageCommand_W); - CreateServiceFunction(MS_MSG_SETSTATUSTEXT, SetStatusText); CreateServiceFunction("SRMsg/ReadMessage", ReadMessageCommand); SkinAddNewSoundEx("RecvMsgActive", LPGEN("Instant messages"), LPGEN("Incoming (focused window)")); diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h index fea335010a..a94cb6a08d 100644 --- a/src/core/stdmsg/src/msgs.h +++ b/src/core/stdmsg/src/msgs.h @@ -112,6 +112,7 @@ public: virtual void CloseTab() override; virtual void LoadSettings() override {} virtual void ScrollToBottom() override; + virtual void SetStatusText(const wchar_t*, HICON) override; virtual void UpdateTitle() override {} void OnSplitterMoved(CSplitter*); @@ -120,7 +121,6 @@ public: void OnOptionsApplied(bool bUpdateAvatar); - void SetStatusData(StatusTextData*); void UpdateReadChars(void); __forceinline MCONTACT getActiveContact() const -- cgit v1.2.3