don't save settings on quit, if readSettings() not finished #56

Merged
blue merged 1 commits from shunf4/squawk:fix/wait_init_before_exit into messageFeed 2021-10-16 15:39:42 +00:00
2 changed files with 38 additions and 32 deletions

View File

@ -27,7 +27,8 @@ Core::Squawk::Squawk(QObject* parent):
accounts(),
amap(),
network(),
waitingForAccounts(0)
waitingForAccounts(0),
isInitialized(false)
#ifdef WITH_KWALLET
,kwallet()
#endif
@ -66,6 +67,8 @@ void Core::Squawk::stop()
{
qDebug("Stopping squawk core..");
network.stop();
if (isInitialized) {
QSettings settings;
settings.beginGroup("core");
settings.beginWriteArray("accounts");
@ -99,6 +102,7 @@ void Core::Squawk::stop()
settings.endGroup();
settings.sync();
}
emit quit();
}
@ -108,6 +112,7 @@ void Core::Squawk::start()
qDebug("Starting squawk core..");
readSettings();
isInitialized = true;
network.start();
}

View File

@ -133,6 +133,7 @@ private:
Shared::Availability state;
NetworkAccess network;
uint8_t waitingForAccounts;
bool isInitialized;
#ifdef WITH_KWALLET
PSE::KWallet kwallet;