GUI: If project open failed project got invalid.
The project was deleted but not set as NULL when the project open failed. Fix this by deleting the project only when the opening succeeds.
This commit is contained in:
parent
e81fa46699
commit
9de4ce8c8e
|
@ -724,8 +724,6 @@ void MainWindow::OpenHtmlHelpContents()
|
||||||
|
|
||||||
void MainWindow::OpenProjectFile()
|
void MainWindow::OpenProjectFile()
|
||||||
{
|
{
|
||||||
delete mProject;
|
|
||||||
|
|
||||||
const QString filter = tr("Project files (*.cppcheck);;All files(*.*)");
|
const QString filter = tr("Project files (*.cppcheck);;All files(*.*)");
|
||||||
QString filepath = QFileDialog::getOpenFileName(this,
|
QString filepath = QFileDialog::getOpenFileName(this,
|
||||||
tr("Select Project File"),
|
tr("Select Project File"),
|
||||||
|
@ -740,6 +738,7 @@ void MainWindow::OpenProjectFile()
|
||||||
|
|
||||||
mUI.mActionCloseProjectFile->setEnabled(true);
|
mUI.mActionCloseProjectFile->setEnabled(true);
|
||||||
mUI.mActionEditProjectFile->setEnabled(true);
|
mUI.mActionEditProjectFile->setEnabled(true);
|
||||||
|
delete mProject;
|
||||||
mProject = new Project(filepath, this);
|
mProject = new Project(filepath, this);
|
||||||
mProject->Open();
|
mProject->Open();
|
||||||
QString rootpath = mProject->GetProjectFile()->GetRootPath();
|
QString rootpath = mProject->GetProjectFile()->GetRootPath();
|
||||||
|
|
Loading…
Reference in New Issue