Blame 0001-Fix-a-wx-assert-complaining-that-a-panel-was-being-a.patch

1501b8
From 20eb7c386d41fb2ee9fba4a3782403bcc476e236 Mon Sep 17 00:00:00 2001
1501b8
From: dghart <dghart@users.sourceforge.net>
1501b8
Date: Sun, 13 Feb 2022 10:58:47 +0000
1501b8
Subject: [PATCH] Fix a wx assert complaining that a panel was being added to
1501b8
 the wrong sizer
1501b8
1501b8
The assert was technically correct, though it made no difference in practice.
1501b8
However correcting it resulting in a double-free issue on deletion, fixed by not explicitly deleting the dirctrl's toolbar in the dtor.
1501b8
---
1501b8
 MyDirs.cpp  | 1 -
1501b8
 MyFrame.cpp | 2 +-
1501b8
 2 files changed, 1 insertion(+), 2 deletions(-)
1501b8
1501b8
diff --git a/MyDirs.cpp b/MyDirs.cpp
1501b8
index f370d5b..d4b8b81 100644
1501b8
--- a/MyDirs.cpp
1501b8
+++ b/MyDirs.cpp
1501b8
@@ -435,7 +435,6 @@ enum
1501b8
 
1501b8
 DirGenericDirCtrl::~DirGenericDirCtrl()
1501b8
 { 
1501b8
-if (toolBar != NULL)  toolBar->Destroy();
1501b8
 }
1501b8
 
1501b8
 void DirGenericDirCtrl::OnIdle(wxIdleEvent& WXUNUSED(event))
1501b8
diff --git a/MyFrame.cpp b/MyFrame.cpp
1501b8
index b3d8ebf..e59b003 100644
1501b8
--- a/MyFrame.cpp
1501b8
+++ b/MyFrame.cpp
1501b8
@@ -2655,7 +2655,7 @@ DirSizer = new wxBoxSizer(wxVERTICAL);
1501b8
 FileSizer= new wxBoxSizer(wxVERTICAL);
1501b8
 DirToolbarSizer= new wxBoxSizer(wxVERTICAL);
1501b8
 
1501b8
-m_highlight_panel = new wxPanel(this);
1501b8
+m_highlight_panel = new wxPanel(DirPanel);
1501b8
 m_highlight_panel->SetBackgroundColour(*wxGetApp().GetBackgroundColourUnSelected());
1501b8
 wxBoxSizer* highlight_panelSizer= new wxBoxSizer(wxVERTICAL);
1501b8
 m_highlight_panel->SetSizer(highlight_panelSizer);
1501b8
-- 
1501b8
2.37.2
1501b8