Refactored Workspace cleanup
FossilOrigin-Name: 3a653a3761f6f6e565762b8730bf5f7447ca2d2b
This commit is contained in:
@ -209,12 +209,15 @@ MainWindow::~MainWindow()
|
||||
stopUI();
|
||||
updateSettings();
|
||||
|
||||
// Dispose RepoFiles
|
||||
for(Workspace::filemap_t::iterator it = getWorkspace().getFiles().begin(); it!=getWorkspace().getFiles().end(); ++it)
|
||||
delete *it;
|
||||
|
||||
delete ui;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
Workspace::~Workspace()
|
||||
{
|
||||
clearState();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
const QString &MainWindow::getCurrentWorkspace()
|
||||
{
|
||||
@ -583,6 +586,17 @@ bool MainWindow::refresh()
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void Workspace::clearState()
|
||||
{
|
||||
// Dispose RepoFiles
|
||||
foreach(RepoFile *r, getFiles())
|
||||
delete r;
|
||||
|
||||
getFiles().clear();
|
||||
getPaths().clear();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void Workspace::scanWorkspace(bool scanLocal, bool scanIgnored, bool scanModified, bool scanUnchanged, const QString &ignoreGlob, Bridge::UICallback &uiCallback, bool &operationAborted)
|
||||
{
|
||||
@ -600,12 +614,7 @@ void Workspace::scanWorkspace(bool scanLocal, bool scanIgnored, bool scanModifie
|
||||
|
||||
bool scan_files = scanLocal;
|
||||
|
||||
// Dispose RepoFiles
|
||||
for(Workspace::filemap_t::iterator it = getFiles().begin(); it!=getFiles().end(); ++it)
|
||||
delete *it;
|
||||
|
||||
getFiles().clear();
|
||||
getPaths().clear();
|
||||
clearState();
|
||||
|
||||
operationAborted = false;
|
||||
|
||||
|
@ -108,9 +108,13 @@ typedef QSet<QString> stringset_t;
|
||||
class Workspace
|
||||
{
|
||||
public:
|
||||
~Workspace();
|
||||
|
||||
typedef QList<RepoFile*> filelist_t;
|
||||
typedef QMap<QString, RepoFile*> filemap_t;
|
||||
|
||||
void clearState();
|
||||
|
||||
Bridge & fossil() { return bridge; }
|
||||
const Bridge & fossil() const { return bridge; }
|
||||
|
||||
|
Reference in New Issue
Block a user