mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-24 05:15:40 +03:00
Assert validity of accountstate and its accountptr when adding it
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
74a78242e2
commit
1689f7b613
2 changed files with 6 additions and 5 deletions
|
@ -568,11 +568,12 @@ QString AccountManager::generateFreeAccountId() const
|
|||
}
|
||||
}
|
||||
|
||||
void AccountManager::addAccountState(AccountState *accountState)
|
||||
void AccountManager::addAccountState(AccountState *const accountState)
|
||||
{
|
||||
QObject::connect(accountState->account().data(),
|
||||
&Account::wantsAccountSaved,
|
||||
this, &AccountManager::saveAccount);
|
||||
Q_ASSERT(accountState);
|
||||
Q_ASSERT(accountState->account());
|
||||
|
||||
QObject::connect(accountState->account().data(), &Account::wantsAccountSaved, this, &AccountManager::saveAccount);
|
||||
|
||||
AccountStatePtr ptr(accountState);
|
||||
_accounts << ptr;
|
||||
|
|
|
@ -126,7 +126,7 @@ private:
|
|||
[[nodiscard]] QString generateFreeAccountId() const;
|
||||
|
||||
// Adds an account to the tracked list, emitting accountAdded()
|
||||
void addAccountState(AccountState *accountState);
|
||||
void addAccountState(AccountState *const accountState);
|
||||
|
||||
AccountManager() = default;
|
||||
QList<AccountStatePtr> _accounts;
|
||||
|
|
Loading…
Reference in a new issue