Skip to content

Commit 8a2f58b

Browse files
committed
solved assertion closing tab in splitter-mode.
still a stack-overflow (round tripping messages) when 'Process Colors' is toggled
1 parent 5b14c1d commit 8a2f58b

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

DebugView++/MainFrame.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@ void CLogViewTabItem2::Create(HWND parent)
152152
m_bottom.SetClient(m_timelineView);
153153
}
154154

155+
CLogViewTabItem2::~CLogViewTabItem2()
156+
{
157+
m_split.DestroyWindow();
158+
}
159+
160+
155161
void CLogViewTabItem2::SetView(std::shared_ptr<CLogView> pView)
156162
{
157163
m_pView = pView;
@@ -807,6 +813,8 @@ void CMainFrame::AddFilterView(std::shared_ptr<CLogView> logview)
807813
pTabItem->SetView(logview);
808814

809815
int newIndex = GetTabCtrl().GetItemCount();
816+
817+
// notice: InsertItem takes ownership of the raw pointer, DeleteItem calls delete
810818
GetTabCtrl().InsertItem(newIndex, pTabItem.release());
811819
GetTabCtrl().SetCurSel(newIndex);
812820
ShowTabControl();
@@ -1418,6 +1426,7 @@ void CMainFrame::CloseView(int i)
14181426
int views = GetViewCount();
14191427
if (i >= 0 && i < views)
14201428
{
1429+
// DeleteItem actually calls delete on the contained item
14211430
GetTabCtrl().DeleteItem(i, false);
14221431
GetTabCtrl().SetCurSel(i == views - 1 ? i - 1 : i);
14231432
if (GetViewCount() == 1)

DebugView++/MainFrame.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ class CMyPaneContainer : public CPaneContainerImpl<CMyPaneContainer>
7171
class CLogViewTabItem2 : public CTabViewTabItem
7272
{
7373
public:
74+
~CLogViewTabItem2();
7475
void SetView(std::shared_ptr<CLogView> pView);
7576
CLogView& GetView();
7677

GDIGraphicsPOC/MainFrame.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ namespace fusion
5757
void CMainFrame::AddTab(const std::wstring name)
5858
{
5959
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
6161
lvi->SetText(name.c_str());
6262
lvi->Create(*this);
6363

0 commit comments

Comments
 (0)