@@ -101,7 +101,7 @@ MainFrame::MainFrame(wxWindow* parent) : MainFrameBase( parent )
101101 */
102102void MainFrame::SizeRootFolder (const string& folder){
103103 // deallocate existing data
104- delete currentDisplay[0 ]->data ;
104+ currentDisplay[0 ]->Dealloc () ;
105105 // clear the log
106106 logCtrl->SetValue (" " );
107107 // hide the log
@@ -123,14 +123,14 @@ void MainFrame::SizeRootFolder(const string& folder){
123123 wxPostEvent (this , event);
124124 };
125125 currentDisplay[0 ]->Clear ();
126- currentDisplay[0 ]->data = new DirectoryData (folder, true );
126+ currentDisplay[0 ]->SetData ( new DirectoryData (folder, true ) );
127127 wxDataViewItem i;
128128
129129 // reset viewing area
130- // for (int i = 1; i < currentDisplay.size(); i++){
131- // delete currentDisplay[i]->data ;
132- // currentDisplay[i]->Destroy();
133- // }
130+ for (int i = 1 ; i < currentDisplay.size (); i++){
131+ currentDisplay[i]->Dealloc () ;
132+ currentDisplay[i]->Destroy ();
133+ }
134134 currentDisplay.erase (currentDisplay.begin ()+1 ,currentDisplay.end ());
135135 // update sizer size
136136 scrollSizer->SetCols (1 );
@@ -244,10 +244,10 @@ void MainFrame::OnReloadFolder(wxCommandEvent& event){
244244 int index = 0 ;
245245 int parent_idx = 0 ;
246246 for (FolderDisplay* disp : currentDisplay){
247- if (selected->parent != nullptr && disp->data -> Path == selected-> parent ->Path ){
247+ if (selected->parent != nullptr && disp->GetPath () == selected->Path ){
248248 parent_idx = index;
249249 }
250- if (disp->data -> Path == selected->Path ){
250+ if (disp->GetPath () == selected->Path ){
251251 toReload = disp;
252252 break ;
253253 }
@@ -257,7 +257,7 @@ void MainFrame::OnReloadFolder(wxCommandEvent& event){
257257 // not opened? open it first
258258 if (toReload == nullptr ){
259259 toReload = ChangeSelection (selected);
260- toReload->data = selected;
260+ toReload->SetData ( selected) ;
261261 }
262262
263263 FolderDisplay* fdisp = currentDisplay[parent_idx];
@@ -302,7 +302,7 @@ void MainFrame::OnOpenFolder(wxCommandEvent& event){
302302void MainFrame::OnExit (wxCommandEvent& event)
303303{
304304 // deallocate structure
305- delete currentDisplay[0 ]->data ;
305+ currentDisplay[0 ]->Dealloc () ;
306306 Close ( true );
307307}
308308/* *
@@ -370,7 +370,7 @@ FolderDisplay* MainFrame::ChangeSelection(DirectoryData* sender){
370370 // find where the sender is in the list
371371 int idx;
372372 for (idx = 0 ; idx < currentDisplay.size (); idx++){
373- if (currentDisplay[idx]->data -> Path == sender->parent ->Path ){
373+ if (currentDisplay[idx]->GetPath () == sender->parent ->Path ){
374374 break ;
375375 }
376376 }
0 commit comments