Fix reading settings with factory created object.

Before we had factory methods, the allocated CContextSettings object
was reused. The temporary one can be deleted.
This commit is contained in:
Roland Winklmeier
2014-06-15 19:02:46 +02:00
parent 9d087dba44
commit 14e9e01b90

View File

@@ -312,12 +312,16 @@ namespace BlackCore
QTime time;
time.start();
// FIXME RW: We are allocating a full settings context in order to get the DBus address.
// I wonder if this can be done cleaner.
if (config.hasDBusAddress()) dbusAddress = config.getDBusAddress(); // bootstrap / explicit
if (config.hasLocalSettings())
{
settings = new CContextSettings(config.getModeSettings(), this);
if (settings) settings->read();
if (dbusAddress.isEmpty()) dbusAddress = settings->getNetworkSettings().getDBusServerAddress();
settings->deleteLater();
}
// DBus
@@ -338,6 +342,7 @@ namespace BlackCore
// contexts
this->m_contextSettings = IContextSettings::create(this, config.getModeSettings(), this->m_dbusServer, this->m_dbusConnection);
this->m_contextSettings->read();
times.insert("Settings", time.restart());
this->m_contextApplication = IContextApplication::create(this, config.getModeApplication(), this->m_dbusServer, this->m_dbusConnection);