Skip to content
Snippets Groups Projects
Commit 75cad12c authored by Sébastien Blin's avatar Sébastien Blin Committed by Amin Bandali
Browse files

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
parent d7045b5d
No related branches found
No related tags found
No related merge requests found
......@@ -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})
......
......@@ -217,7 +217,6 @@ Q_ENUM_NS(LookupStatus)
struct Info
{
bool freeable = false;
bool valid = true;
QString registeredName;
Status status = account::Status::INVALID;
......
......@@ -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
......
......@@ -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"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment