From 7253436a88270d83009626a1a5021658de85e8e8 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 1 Feb 2018 23:55:26 +0300 Subject: fixes #1128 (StdMsg: user menu icon bug) --- src/core/stdmsg/src/msgdialog.cpp | 9 ++++++--- src/core/stdmsg/src/msgs.h | 5 +++-- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 712abd33f4..6215e1d55a 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -275,6 +275,8 @@ void CSrmmWindow::OnDestroy() if (m_hBkgBrush) DeleteObject(m_hBkgBrush); + if (m_hStatusIcon) + IcoLib_ReleaseIcon(m_hStatusIcon); for (int i = 0; i < m_cmdList.getCount(); i++) mir_free(m_cmdList[i]); @@ -1029,11 +1031,12 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)wParam; if (!cws || (!mir_strcmp(cws->szModule, m_szProto) && !mir_strcmp(cws->szSetting, "Status"))) { if (m_szProto) { - int dwStatus = db_get_w(m_hContact, m_szProto, "Status", ID_STATUS_OFFLINE); - HICON hIcon = Skin_LoadProtoIcon(m_szProto, dwStatus); + HICON hIcon = Skin_LoadProtoIcon(m_szProto, m_wStatus); if (hIcon) { + if (m_hStatusIcon) + IcoLib_ReleaseIcon(m_hStatusIcon); + m_hStatusIcon = hIcon; SendDlgItemMessage(m_hwnd, IDC_USERMENU, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); - IcoLib_ReleaseIcon(hIcon); } } if (g_dat.bUseStatusWinIcon) diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h index 1a216ce36f..fc6c9000fb 100644 --- a/src/core/stdmsg/src/msgs.h +++ b/src/core/stdmsg/src/msgs.h @@ -79,8 +79,9 @@ class CSrmmWindow : public CMsgDialog void StreamInEvents(MEVENT hDbEventFirst, int count, bool bAppend); char *m_szProto; - HFONT m_hFont; - HBRUSH m_hBkgBrush; + HICON m_hStatusIcon = nullptr; + HFONT m_hFont = nullptr; + HBRUSH m_hBkgBrush = nullptr; SIZE m_minEditBoxSize; RECT m_minEditInit; -- cgit v1.2.3