1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-09-09 19:43:31 +02:00

misc: remove freeable flag

It was badly set as client-qt never used this but is enabled
since the merge of jami-libclient, making it not possible to
remove an account.

Change-Id: If7acb9aedacaa9309f741078e89a900ee2940df9
This commit is contained in:
Sébastien Blin 2022-06-23 09:40:20 -04:00 committed by Amin Bandali
parent d7045b5d54
commit 75cad12cde
4 changed files with 0 additions and 49 deletions

View file

@ -176,24 +176,6 @@ if(NOT (${ENABLE_PLUGIN} MATCHES false))
add_definitions(-DENABLE_PLUGIN=true)
endif()
set(CHK_FREEABLE_BEFORE_ERASE_ACCOUNT_DESCRIPTION
"Check that an account has been marked freeable by the client
before freeing the structures. This avoids various race conditions
conditions while removing accounts but may not be supported by all
clients. ON by default on GNU/Linux systems, otherwise OFF.")
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
option(CHK_FREEABLE_BEFORE_ERASE_ACCOUNT
CHK_FREEABLE_BEFORE_ERASE_ACCOUNT_DESCRIPTION ON)
else()
option(CHK_FREEABLE_BEFORE_ERASE_ACCOUNT
CHK_FREEABLE_BEFORE_ERASE_ACCOUNT_DESCRIPTION OFF)
endif()
if(CHK_FREEABLE_BEFORE_ERASE_ACCOUNT)
add_definitions(-DCHK_FREEABLE_BEFORE_ERASE_ACCOUNT)
endif()
include_directories(SYSTEM ${QT_INCLUDES})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR})

View file

@ -217,7 +217,6 @@ Q_ENUM_NS(LookupStatus)
struct Info
{
bool freeable = false;
bool valid = true;
QString registeredName;
Status status = account::Status::INVALID;

View file

@ -67,10 +67,6 @@ public:
* @return a const account::Info& structure.
*/
const account::Info& getAccountInfo(const QString& accountId) const;
/**
* flag account corresponding to passed id as freeable.
*/
void flagFreeable(const QString& accountId) const;
/**
* Used when images < 20 Mb are automatically accepted and downloaded

View file

@ -77,9 +77,6 @@ public:
AccountInfoDbMap accounts;
// Synchronization tools
std::mutex m_mutex_account;
std::mutex m_mutex_account_removal;
std::condition_variable m_condVar_account_removal;
std::atomic_bool username_changed;
QString new_username;
@ -343,21 +340,6 @@ NewAccountModel::changeAccountPassword(const QString& accountId,
newPassword);
}
void
NewAccountModel::flagFreeable(const QString& accountId) const
{
auto account = pimpl_->accounts.find(accountId);
if (account == pimpl_->accounts.end())
throw std::out_of_range("NewAccountModel::flagFreeable, can't find "
+ accountId.toStdString());
{
std::lock_guard<std::mutex> lock(pimpl_->m_mutex_account_removal);
account->second.first.freeable = true;
}
pimpl_->m_condVar_account_removal.notify_all();
}
const account::Info&
NewAccountModel::getAccountInfo(const QString& accountId) const
{
@ -790,13 +772,6 @@ NewAccountModelPimpl::removeFromAccounts(const QString& accountId)
accountInfo.valid = false;
Q_EMIT linked.accountRemoved(accountId);
#ifdef CHK_FREEABLE_BEFORE_ERASE_ACCOUNT
std::unique_lock<std::mutex> lock(m_mutex_account_removal);
// Wait for client to stop using old account structs
m_condVar_account_removal.wait(lock, [&]() { return accounts[accountId].first.freeable; });
lock.unlock();
#endif
// Now we can free them
accounts.erase(accountId);
}
@ -1228,7 +1203,6 @@ NewAccountModel::avatar(const QString& accountId) const
return authority::storage::avatar(accountId);
}
} // namespace lrc
#include "api/moc_newaccountmodel.cpp"