summaryrefslogtreecommitdiff
path: root/src/mir_core
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-06-06 23:57:33 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-06-06 23:57:33 +0300
commit26c4d6fab772865973dd47ed38ff2ce5cdd47a47 (patch)
tree73b75df52224795f4c58dfb2aa31cf1890eee134 /src/mir_core
parent862592785fd1242260e9476207a6004edcceff1f (diff)
fix for occasional crash in CCtrlPages
Diffstat (limited to 'src/mir_core')
-rw-r--r--src/mir_core/src/CCtrlPages.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/mir_core/src/CCtrlPages.cpp b/src/mir_core/src/CCtrlPages.cpp
index b0d07450cc..d56231b796 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();