diff options
Diffstat (limited to 'libinstance/src')
-rw-r--r-- | libinstance/src/instancelist.cpp | 9 | ||||
-rw-r--r-- | libinstance/src/instanceloader.cpp | 6 |
2 files changed, 9 insertions, 6 deletions
diff --git a/libinstance/src/instancelist.cpp b/libinstance/src/instancelist.cpp index 15f79d05..3b0b668f 100644 --- a/libinstance/src/instancelist.cpp +++ b/libinstance/src/instancelist.cpp @@ -43,9 +43,10 @@ InstanceList::InstListError InstanceList::loadList() QString subDir = iter.next(); if (QFileInfo(PathCombine(subDir, "instance.cfg")).exists()) { - QSharedPointer<Instance> inst; + Instance *instPtr = NULL; + InstanceLoader::InstTypeError error = InstanceLoader::get(). - loadInstance(inst.data(), subDir); + loadInstance(instPtr, subDir); if (error != InstanceLoader::NoError && error != InstanceLoader::NotAnInstance) @@ -66,13 +67,15 @@ InstanceList::InstListError InstanceList::loadList() } qDebug(errorMsg.toUtf8()); } - else if (!inst.data()) + else if (!instPtr) { qDebug(QString("Error loading instance %1. Instance loader returned null."). arg(QFileInfo(subDir).baseName()).toUtf8()); } else { + QSharedPointer<Instance> inst(instPtr); + qDebug(QString("Loaded instance %1").arg(inst->name()).toUtf8()); inst->setParent(this); append(QSharedPointer<Instance>(inst)); diff --git a/libinstance/src/instanceloader.cpp b/libinstance/src/instanceloader.cpp index eff9d56e..620562b6 100644 --- a/libinstance/src/instanceloader.cpp +++ b/libinstance/src/instanceloader.cpp @@ -49,7 +49,7 @@ InstanceLoader::InstTypeError InstanceLoader::registerInstanceType(InstanceTypeI return NoError; } -InstanceLoader::InstTypeError InstanceLoader::createInstance(Instance *inst, +InstanceLoader::InstTypeError InstanceLoader::createInstance(Instance *&inst, const InstanceTypeInterface *type, const QString &instDir) { @@ -61,7 +61,7 @@ InstanceLoader::InstTypeError InstanceLoader::createInstance(Instance *inst, return type->createInstance(inst, instDir); } -InstanceLoader::InstTypeError InstanceLoader::loadInstance(Instance *inst, +InstanceLoader::InstTypeError InstanceLoader::loadInstance(Instance *&inst, const InstanceTypeInterface *type, const QString &instDir) { @@ -72,7 +72,7 @@ InstanceLoader::InstTypeError InstanceLoader::loadInstance(Instance *inst, return type->loadInstance(inst, instDir); } -InstanceLoader::InstTypeError InstanceLoader::loadInstance(Instance *inst, +InstanceLoader::InstTypeError InstanceLoader::loadInstance(Instance *&inst, const QString &instDir) { QFileInfo instConfig(PathCombine(instDir, "instance.cfg")); |