GUI: Fix for loading "oldstyle" project file.

This commit is contained in:
Kimmo Varis 2010-08-24 20:50:25 +03:00
parent 4ccdcf0fc2
commit ce0f65e761
1 changed files with 6 additions and 4 deletions

View File

@ -317,6 +317,7 @@ Settings MainWindow::GetCppcheckSettings()
if (QFile::exists(projfile)) if (QFile::exists(projfile))
{ {
qDebug() << "Reading project file " << projfile; qDebug() << "Reading project file " << projfile;
pfile = new ProjectFile();
projectRead = pfile->Read(projfile); projectRead = pfile->Read(projfile);
} }
} }
@ -352,6 +353,9 @@ Settings MainWindow::GetCppcheckSettings()
} }
} }
if (!mProject)
delete pfile;
result._debug = false; result._debug = false;
result._checkCodingStyle = true; result._checkCodingStyle = true;
result._errorsOnly = false; result._errorsOnly = false;
@ -685,7 +689,6 @@ void MainWindow::OpenHtmlHelpContents()
void MainWindow::OpenProjectFile() void MainWindow::OpenProjectFile()
{ {
if (mProject != NULL)
delete mProject; delete mProject;
const QString filter = tr("Project files (*.cppcheck);;All files(*.*)"); const QString filter = tr("Project files (*.cppcheck);;All files(*.*)");
@ -747,7 +750,6 @@ void MainWindow::NewProjectFile()
const QString filename = inf.fileName(); const QString filename = inf.fileName();
FormatAndSetTitle(tr("Project:") + QString(" ") + filename); FormatAndSetTitle(tr("Project:") + QString(" ") + filename);
if (mProject)
delete mProject; delete mProject;
mProject = new Project(filepath, this); mProject = new Project(filepath, this);
mProject->Create(); mProject->Create();