From 75cad12cde4ee4277f77674946390cf36afea031 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= <sebastien.blin@savoirfairelinux.com> Date: Thu, 23 Jun 2022 09:40:20 -0400 Subject: [PATCH] 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 --- src/libclient/CMakeLists.txt | 18 ------------------ src/libclient/api/account.h | 1 - src/libclient/api/newaccountmodel.h | 4 ---- src/libclient/newaccountmodel.cpp | 26 -------------------------- 4 files changed, 49 deletions(-) diff --git a/src/libclient/CMakeLists.txt b/src/libclient/CMakeLists.txt index d4acf7d1f..50f21b346 100644 --- a/src/libclient/CMakeLists.txt +++ b/src/libclient/CMakeLists.txt @@ -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}) diff --git a/src/libclient/api/account.h b/src/libclient/api/account.h index f9c38d0aa..958bd5347 100644 --- a/src/libclient/api/account.h +++ b/src/libclient/api/account.h @@ -217,7 +217,6 @@ Q_ENUM_NS(LookupStatus) struct Info { - bool freeable = false; bool valid = true; QString registeredName; Status status = account::Status::INVALID; diff --git a/src/libclient/api/newaccountmodel.h b/src/libclient/api/newaccountmodel.h index 743130d2b..9e336cf74 100644 --- a/src/libclient/api/newaccountmodel.h +++ b/src/libclient/api/newaccountmodel.h @@ -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 diff --git a/src/libclient/newaccountmodel.cpp b/src/libclient/newaccountmodel.cpp index 871f0c7c9..f88bb89b5 100644 --- a/src/libclient/newaccountmodel.cpp +++ b/src/libclient/newaccountmodel.cpp @@ -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" -- GitLab