From 81b5ba78f96cb9adb24a9c8883edfbfc8cdfa94b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 6 Jun 2018 23:57:33 +0300 Subject: fix for occasional crash in CCtrlPages --- src/mir_core/src/CCtrlPages.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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(); -- cgit v1.2.3