forked from qt-creator/qt-creator
JsonWizard: Code cleanup
Make sure project is 0, clang reports a free after use otherwise. Clean up the code a bit. Change-Id: Ie21cc83c589fdc5eed197bd3f005b309c000cc0d Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
This commit is contained in:
@@ -40,6 +40,7 @@
|
|||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
|
|
||||||
|
#include <utils/algorithm.h>
|
||||||
#include <utils/macroexpander.h>
|
#include <utils/macroexpander.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
@@ -96,18 +97,13 @@ void JsonKitsPage::setupProjectFiles(const JsonWizard::GeneratorFiles &files)
|
|||||||
if (mt.isNull())
|
if (mt.isNull())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
foreach (IProjectManager *manager, managerList) {
|
auto manager = Utils::findOrDefault(managerList, Utils::equal(&IProjectManager::mimeType, mt.type()));
|
||||||
if (manager->mimeType() == mt.type()) {
|
project = manager ? manager->openProject(path, &errorMessage) : 0;
|
||||||
project = manager->openProject(path, &errorMessage);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (project) {
|
if (project) {
|
||||||
bool success = setupProject(project);
|
if (setupProject(project))
|
||||||
if (success)
|
|
||||||
project->saveSettings();
|
project->saveSettings();
|
||||||
delete project;
|
delete project;
|
||||||
|
project = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user