Commit 14bc65fd authored by Tobias Hunger's avatar Tobias Hunger

Revert "Make sure to never write kits/Qt/TCs before they were read"

This patch causes core dumps in my work-creator while it works fine
in my test creator. Revert till I find the reason for this.

This reverts commit 5d253b37.

Change-Id: Ib9912cda15294c28b9136f79675e0e5694788d5b
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent b1bb59ae
......@@ -323,8 +323,8 @@ KitManager::KitList KitManager::restoreKits(const Utils::FileName &fileName)
QList<Kit *> KitManager::kits(const KitMatcher *m) const
{
if (!d->m_initialized) {
const_cast<KitManager *>(this)->restoreKits();
d->m_initialized = true;
const_cast<KitManager *>(this)->restoreKits();
}
QList<Kit *> result;
......@@ -356,8 +356,8 @@ Kit *KitManager::find(const KitMatcher *m) const
Kit *KitManager::defaultKit()
{
if (!d->m_initialized) {
restoreKits();
d->m_initialized = true;
restoreKits();
}
return d->m_defaultKit;
}
......
......@@ -39,7 +39,6 @@
#include <extensionsystem/pluginmanager.h>
#include <utils/persistentsettings.h>
#include <utils/qtcassert.h>
#include <QCoreApplication>
#include <QDir>
......@@ -82,6 +81,7 @@ public:
QList<ToolChain *> &toolChains();
ToolChainManager *q;
bool m_initialized;
QMap<QString, Utils::FileName> m_abiToDebugger;
Utils::PersistentSettingsWriter *m_writer;
......@@ -90,7 +90,8 @@ private:
};
ToolChainManagerPrivate::ToolChainManagerPrivate(ToolChainManager *parent)
: q(parent), m_writer(0)
: q(parent), m_initialized(false),
m_writer(new Utils::PersistentSettingsWriter(settingsFileName(QLatin1String(TOOLCHAIN_FILENAME)), QLatin1String("QtCreatorToolChains")))
{ }
ToolChainManagerPrivate::~ToolChainManagerPrivate()
......@@ -98,8 +99,10 @@ ToolChainManagerPrivate::~ToolChainManagerPrivate()
QList<ToolChain *> &ToolChainManagerPrivate::toolChains()
{
if (!m_writer)
if (!m_initialized) {
m_initialized = true;
q->restoreToolChains();
}
return m_toolChains;
}
......@@ -133,10 +136,6 @@ ToolChainManager::ToolChainManager(QObject *parent) :
void ToolChainManager::restoreToolChains()
{
QTC_ASSERT(!d->m_writer, return);
d->m_writer =
new Utils::PersistentSettingsWriter(settingsFileName(QLatin1String(TOOLCHAIN_FILENAME)), QLatin1String("QtCreatorToolChains"));
QList<ToolChain *> tcsToRegister;
QList<ToolChain *> tcsToCheck;
......
......@@ -177,10 +177,6 @@ QtVersionManager *QtVersionManager::instance()
bool QtVersionManager::restoreQtVersions()
{
QTC_ASSERT(!m_writer, return false);
m_writer = new Utils::PersistentSettingsWriter(settingsFileName(QLatin1String(QTVERSION_FILENAME)),
QLatin1String("QtCreatorQtVersions"));
QList<QtVersionFactory *> factories = ExtensionSystem::PluginManager::getObjects<QtVersionFactory>();
Utils::PersistentSettingsReader reader;
......@@ -366,7 +362,8 @@ void QtVersionManager::updateFromInstaller(bool emitSignal)
void QtVersionManager::saveQtVersions()
{
if (!m_writer)
return;
m_writer = new Utils::PersistentSettingsWriter(settingsFileName(QLatin1String(QTVERSION_FILENAME)),
QLatin1String("QtCreatorQtVersions"));
QVariantMap data;
data.insert(QLatin1String(QTVERSION_FILE_VERSION_KEY), 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment