diff options
author | George Hazan <ghazan@miranda.im> | 2018-06-06 23:57:33 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-06-06 23:58:14 +0300 |
commit | 81b5ba78f96cb9adb24a9c8883edfbfc8cdfa94b (patch) | |
tree | 0f6467e3503a159463a0f37d5924b0bb6b931e8e | |
parent | bf888032ef5235a8c6fa9d692f8d0e8a84ade592 (diff) |
fix for occasional crash in CCtrlPages
-rw-r--r-- | src/mir_core/src/CCtrlPages.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/mir_core/src/CCtrlPages.cpp b/src/mir_core/src/CCtrlPages.cpp index 88e6a9d59c..8e24d8f4fd 100644 --- a/src/mir_core/src/CCtrlPages.cpp +++ b/src/mir_core/src/CCtrlPages.cpp @@ -22,17 +22,25 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" +static volatile long g_order = 1; + ///////////////////////////////////////////////////////////////////////////////////////// // CCtrlPages struct CCtrlPages::TPageInfo : public MZeroedObject { + TPageInfo() + { + m_iOrder = InterlockedIncrement(&g_order); + } + ~TPageInfo() { if (m_hIcon) DestroyIcon(m_hIcon); } + int m_iOrder; ptrW m_ptszHeader; HICON m_hIcon; bool m_bChanged, m_bScheduledResize; @@ -43,7 +51,7 @@ CCtrlPages::CCtrlPages(CDlgBase *dlg, int ctrlId) : CCtrlBase(dlg, ctrlId), m_hIml(nullptr), m_pActivePage(nullptr), - m_pages(4) + m_pages(4, NumericKeySortT) {} void CCtrlPages::OnInit() @@ -247,6 +255,7 @@ void CCtrlPages::RemovePage(int iPage) return; TabCtrl_DeleteItem(m_hwnd, iPage); + m_pages.remove(p); delete p; CheckRowCount(); |