mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 04:45:31 +08:00
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:
@@ -312,12 +312,16 @@ namespace BlackCore
|
|||||||
QTime time;
|
QTime time;
|
||||||
time.start();
|
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.hasDBusAddress()) dbusAddress = config.getDBusAddress(); // bootstrap / explicit
|
||||||
if (config.hasLocalSettings())
|
if (config.hasLocalSettings())
|
||||||
{
|
{
|
||||||
settings = new CContextSettings(config.getModeSettings(), this);
|
settings = new CContextSettings(config.getModeSettings(), this);
|
||||||
if (settings) settings->read();
|
if (settings) settings->read();
|
||||||
if (dbusAddress.isEmpty()) dbusAddress = settings->getNetworkSettings().getDBusServerAddress();
|
if (dbusAddress.isEmpty()) dbusAddress = settings->getNetworkSettings().getDBusServerAddress();
|
||||||
|
|
||||||
|
settings->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
// DBus
|
// DBus
|
||||||
@@ -338,6 +342,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
// contexts
|
// contexts
|
||||||
this->m_contextSettings = IContextSettings::create(this, config.getModeSettings(), this->m_dbusServer, this->m_dbusConnection);
|
this->m_contextSettings = IContextSettings::create(this, config.getModeSettings(), this->m_dbusServer, this->m_dbusConnection);
|
||||||
|
this->m_contextSettings->read();
|
||||||
times.insert("Settings", time.restart());
|
times.insert("Settings", time.restart());
|
||||||
|
|
||||||
this->m_contextApplication = IContextApplication::create(this, config.getModeApplication(), this->m_dbusServer, this->m_dbusConnection);
|
this->m_contextApplication = IContextApplication::create(this, config.getModeApplication(), this->m_dbusServer, this->m_dbusConnection);
|
||||||
|
|||||||
Reference in New Issue
Block a user