File tree Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -152,6 +152,12 @@ void CLogViewTabItem2::Create(HWND parent)
152
152
m_bottom.SetClient (m_timelineView);
153
153
}
154
154
155
+ CLogViewTabItem2::~CLogViewTabItem2 ()
156
+ {
157
+ m_split.DestroyWindow ();
158
+ }
159
+
160
+
155
161
void CLogViewTabItem2::SetView (std::shared_ptr<CLogView> pView)
156
162
{
157
163
m_pView = pView;
@@ -807,6 +813,8 @@ void CMainFrame::AddFilterView(std::shared_ptr<CLogView> logview)
807
813
pTabItem->SetView (logview);
808
814
809
815
int newIndex = GetTabCtrl ().GetItemCount ();
816
+
817
+ // notice: InsertItem takes ownership of the raw pointer, DeleteItem calls delete
810
818
GetTabCtrl ().InsertItem (newIndex, pTabItem.release ());
811
819
GetTabCtrl ().SetCurSel (newIndex);
812
820
ShowTabControl ();
@@ -1418,6 +1426,7 @@ void CMainFrame::CloseView(int i)
1418
1426
int views = GetViewCount ();
1419
1427
if (i >= 0 && i < views)
1420
1428
{
1429
+ // DeleteItem actually calls delete on the contained item
1421
1430
GetTabCtrl ().DeleteItem (i, false );
1422
1431
GetTabCtrl ().SetCurSel (i == views - 1 ? i - 1 : i);
1423
1432
if (GetViewCount () == 1 )
Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ class CMyPaneContainer : public CPaneContainerImpl<CMyPaneContainer>
71
71
class CLogViewTabItem2 : public CTabViewTabItem
72
72
{
73
73
public:
74
+ ~CLogViewTabItem2 ();
74
75
void SetView (std::shared_ptr<CLogView> pView);
75
76
CLogView& GetView ();
76
77
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ namespace fusion
57
57
void CMainFrame::AddTab (const std::wstring name)
58
58
{
59
59
auto lvi = std::make_shared<CLogViewTabItem2>();
60
- m_tabitems.push_back (lvi);
60
+ m_tabitems.push_back (lvi); // InsertItem takes ownership of the raw pointer, so this is not correct
61
61
lvi->SetText (name.c_str ());
62
62
lvi->Create (*this );
63
63
You can’t perform that action at this time.
0 commit comments