Blob Blame History Raw
From 20eb7c386d41fb2ee9fba4a3782403bcc476e236 Mon Sep 17 00:00:00 2001
From: dghart <dghart@users.sourceforge.net>
Date: Sun, 13 Feb 2022 10:58:47 +0000
Subject: [PATCH] Fix a wx assert complaining that a panel was being added to
 the wrong sizer

The assert was technically correct, though it made no difference in practice.
However correcting it resulting in a double-free issue on deletion, fixed by not explicitly deleting the dirctrl's toolbar in the dtor.
---
 MyDirs.cpp  | 1 -
 MyFrame.cpp | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/MyDirs.cpp b/MyDirs.cpp
index f370d5b..d4b8b81 100644
--- a/MyDirs.cpp
+++ b/MyDirs.cpp
@@ -435,7 +435,6 @@ enum
 
 DirGenericDirCtrl::~DirGenericDirCtrl()
 { 
-if (toolBar != NULL)  toolBar->Destroy();
 }
 
 void DirGenericDirCtrl::OnIdle(wxIdleEvent& WXUNUSED(event))
diff --git a/MyFrame.cpp b/MyFrame.cpp
index b3d8ebf..e59b003 100644
--- a/MyFrame.cpp
+++ b/MyFrame.cpp
@@ -2655,7 +2655,7 @@ DirSizer = new wxBoxSizer(wxVERTICAL);
 FileSizer= new wxBoxSizer(wxVERTICAL);
 DirToolbarSizer= new wxBoxSizer(wxVERTICAL);
 
-m_highlight_panel = new wxPanel(this);
+m_highlight_panel = new wxPanel(DirPanel);
 m_highlight_panel->SetBackgroundColour(*wxGetApp().GetBackgroundColourUnSelected());
 wxBoxSizer* highlight_panelSizer= new wxBoxSizer(wxVERTICAL);
 m_highlight_panel->SetSizer(highlight_panelSizer);
-- 
2.37.2