Skip to content
Permalink
Browse files

Fix save buttons and probably other things not being cleaned up in Fi…

…leBrowserActivity (fixed #635)
  • Loading branch information...
LBPHacker committed Mar 24, 2019
1 parent c7ae820 commit 89c7d9ea028347fc349c6a82d712e2d65571812f
Showing with 17 additions and 10 deletions.
  1. +16 −10 src/gui/filebrowser/FileBrowserActivity.cpp
  2. +1 −0 src/gui/filebrowser/FileBrowserActivity.h
@@ -191,25 +191,30 @@ void FileBrowserActivity::RenameSave(SaveFile * file)
ErrorMessage::Blocking("Error", "No save name given");
}

void FileBrowserActivity::loadDirectory(ByteString directory, ByteString search)
void FileBrowserActivity::cleanup()
{
for (size_t i = 0; i < components.size(); i++)
for (auto comp : componentsQueue)
{
RemoveComponent(components[i]);
itemList->RemoveChild(components[i]);
delete comp;
}
componentsQueue.clear();

for (std::vector<ui::Component*>::iterator iter = componentsQueue.begin(), end = componentsQueue.end(); iter != end; ++iter)
for (auto file : files)
{
delete *iter;
delete file;
}
componentsQueue.clear();
files.clear();
}

for (std::vector<SaveFile*>::iterator iter = files.begin(), end = files.end(); iter != end; ++iter)
void FileBrowserActivity::loadDirectory(ByteString directory, ByteString search)
{
for (size_t i = 0; i < components.size(); i++)
{
delete *iter;
RemoveComponent(components[i]);
itemList->RemoveChild(components[i]);
}
files.clear();

cleanup();

infoText->Visible = false;
itemList->Visible = false;
@@ -325,4 +330,5 @@ void FileBrowserActivity::OnDraw()
FileBrowserActivity::~FileBrowserActivity()
{
delete callback;
cleanup();
}
@@ -45,6 +45,7 @@ class FileBrowserActivity: public TaskListener, public WindowActivity

class SearchAction;
void populateList();
void cleanup();
public:
FileBrowserActivity(ByteString directory, FileSelectedCallback * callback);
void OnDraw() override;

0 comments on commit 89c7d9e

Please sign in to comment.
You can’t perform that action at this time.