From 3ceeebafc2a65ba9e9ad8658268a3a9a8df1f9ca Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 20 Apr 2018 14:19:59 +0300 Subject: StdMsg: fixes #1291 (rclick -> Close tab doesn't close a tab) --- src/core/stdmsg/src/tabs.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/core/stdmsg/src/tabs.cpp b/src/core/stdmsg/src/tabs.cpp index f25439dd63..863c70e67e 100644 --- a/src/core/stdmsg/src/tabs.cpp +++ b/src/core/stdmsg/src/tabs.cpp @@ -607,13 +607,14 @@ INT_PTR CTabbedWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) if ((i = TabCtrl_HitTest(((LPNMHDR)lParam)->hwndFrom, &tci)) == -1) break; - SESSION_INFO *si = ((CChatRoomDlg*)m_tab.GetNthPage(i))->m_si; + CMsgDialog *pDlg = (CMsgDialog*)m_tab.GetNthPage(i); + SESSION_INFO *si = pDlg->m_si; ClientToScreen(GetDlgItem(m_hwnd, IDC_TAB), &tci.pt); HMENU hSubMenu = GetSubMenu(g_hMenu, 1); TranslateMenu(hSubMenu); - if (si) { + if (si != nullptr) { WORD w = db_get_w(si->hContact, si->pszModule, "TabPosition", 0); if (w == 0) CheckMenuItem(hSubMenu, ID_LOCKPOSITION, MF_BYCOMMAND | MF_UNCHECKED); @@ -624,7 +625,7 @@ INT_PTR CTabbedWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, tci.pt.x, tci.pt.y, 0, m_hwnd, nullptr)) { case ID_CLOSE: - SendMessage(m_hwnd, GC_REMOVETAB, 0, (LPARAM)m_tab.GetNthPage(i)); + pDlg->CloseTab(); break; case ID_LOCKPOSITION: -- cgit v1.2.3