mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-09-10 12:03:18 +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:
parent
d7045b5d54
commit
75cad12cde
4 changed files with 0 additions and 49 deletions
|
@ -176,24 +176,6 @@ if(NOT (${ENABLE_PLUGIN} MATCHES false))
|
||||||
add_definitions(-DENABLE_PLUGIN=true)
|
add_definitions(-DENABLE_PLUGIN=true)
|
||||||
endif()
|
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(SYSTEM ${QT_INCLUDES})
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
|
@ -217,7 +217,6 @@ Q_ENUM_NS(LookupStatus)
|
||||||
|
|
||||||
struct Info
|
struct Info
|
||||||
{
|
{
|
||||||
bool freeable = false;
|
|
||||||
bool valid = true;
|
bool valid = true;
|
||||||
QString registeredName;
|
QString registeredName;
|
||||||
Status status = account::Status::INVALID;
|
Status status = account::Status::INVALID;
|
||||||
|
|
|
@ -67,10 +67,6 @@ public:
|
||||||
* @return a const account::Info& structure.
|
* @return a const account::Info& structure.
|
||||||
*/
|
*/
|
||||||
const account::Info& getAccountInfo(const QString& accountId) const;
|
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
|
* Used when images < 20 Mb are automatically accepted and downloaded
|
||||||
|
|
|
@ -77,9 +77,6 @@ public:
|
||||||
AccountInfoDbMap accounts;
|
AccountInfoDbMap accounts;
|
||||||
|
|
||||||
// Synchronization tools
|
// 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;
|
std::atomic_bool username_changed;
|
||||||
QString new_username;
|
QString new_username;
|
||||||
|
|
||||||
|
@ -343,21 +340,6 @@ NewAccountModel::changeAccountPassword(const QString& accountId,
|
||||||
newPassword);
|
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&
|
const account::Info&
|
||||||
NewAccountModel::getAccountInfo(const QString& accountId) const
|
NewAccountModel::getAccountInfo(const QString& accountId) const
|
||||||
{
|
{
|
||||||
|
@ -790,13 +772,6 @@ NewAccountModelPimpl::removeFromAccounts(const QString& accountId)
|
||||||
accountInfo.valid = false;
|
accountInfo.valid = false;
|
||||||
Q_EMIT linked.accountRemoved(accountId);
|
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
|
// Now we can free them
|
||||||
accounts.erase(accountId);
|
accounts.erase(accountId);
|
||||||
}
|
}
|
||||||
|
@ -1228,7 +1203,6 @@ NewAccountModel::avatar(const QString& accountId) const
|
||||||
return authority::storage::avatar(accountId);
|
return authority::storage::avatar(accountId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace lrc
|
} // namespace lrc
|
||||||
|
|
||||||
#include "api/moc_newaccountmodel.cpp"
|
#include "api/moc_newaccountmodel.cpp"
|
||||||
|
|
Loading…
Add table
Reference in a new issue