From b0f5b7dce08f96632607c29b5362f90805c73eb7 Mon Sep 17 00:00:00 2001 From: PKEuS Date: Sun, 14 Oct 2012 14:13:54 +0200 Subject: [PATCH] Fixed freeze when canceling projectfile dialog when creating a new Project. Updated gui.pro (forgot it in last commit) --- gui/gui.pro | 2 +- gui/mainwindow.cpp | 8 ++++---- gui/project.cpp | 4 +++- gui/project.h | 3 ++- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/gui/gui.pro b/gui/gui.pro index 9f2e27229..68bad26c0 100644 --- a/gui/gui.pro +++ b/gui/gui.pro @@ -134,6 +134,6 @@ SOURCES += aboutdialog.cpp \ win32 { DEFINES += _CRT_SECURE_NO_WARNINGS RC_FILE = cppcheck-gui.rc - HEADERS += ../cli/resource.h + HEADERS += ../lib/version.h LIBS += -lshlwapi } diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 8d5f18629..5fcb2e894 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -965,10 +965,10 @@ void MainWindow::NewProjectFile() delete mProject; mProject = new Project(filepath, this); mProject->Create(); - mProject->Edit(); - - AddProjectMRU(filepath); - CheckProject(mProject); + if (mProject->Edit()) { + AddProjectMRU(filepath); + CheckProject(mProject); + } } void MainWindow::CloseProjectFile() diff --git a/gui/project.cpp b/gui/project.cpp index 2ab23e90f..c420f3f5c 100644 --- a/gui/project.cpp +++ b/gui/project.cpp @@ -82,7 +82,7 @@ bool Project::Open() return false; } -void Project::Edit() +bool Project::Edit() { ProjectFileDialog dlg(mFilename, mParentWidget); QString root = mPFile->GetRootPath(); @@ -118,7 +118,9 @@ void Project::Edit() mParentWidget); msg.exec(); } + return writeSuccess; } + return false; } void Project::Create() diff --git a/gui/project.h b/gui/project.h index 18f088829..f4fe80ba3 100644 --- a/gui/project.h +++ b/gui/project.h @@ -66,8 +66,9 @@ public: /** * @brief Edit the project file. + * @return true if editing was successful. */ - void Edit(); + bool Edit(); /** * @brief Create new project file.