Commit 7ffd5d48 authored by Pedro Olsen Ferreira's avatar Pedro Olsen Ferreira Committed by Igor Kushnir
Browse files

Replace QMutex(Recursive) with QRecursiveMutex

The declaration of QMutex(Recursive) is deprecated.
This fixes several deprecation warnings.
Many declarations had to be patched in order to return the correct
constructs, because QRecursiveMutex is not convertible to QMutex.
parent 38713121
Pipeline #101367 passed with stage
in 31 minutes and 58 seconds
......@@ -199,7 +199,6 @@ public:
: m_parser(parser)
, m_languageController(languageController)
, m_shuttingDown(false)
, m_mutex(QMutex::Recursive)
{
parser->d_ptr = this; //Set this so we can safely call back BackgroundParser from within loadSettings()
......@@ -549,7 +548,7 @@ public:
ThreadWeaver::Queue m_weaver;
// generic high-level mutex
mutable QMutex m_mutex;
mutable QRecursiveMutex m_mutex;
// local mutex only protecting m_managed
mutable QMutex m_managedMutex;
......
......@@ -15,11 +15,8 @@ using namespace KDevelop;
namespace {
struct PerUrlData
{
PerUrlData()
// TODO: make this non-recursive
: mutex(QMutex::Recursive)
{}
QMutex mutex;
QRecursiveMutex mutex;
// how many people are (trying to) parse this url
// we use this to delete the entry once no-one needs it anymore
uint ref = 0;
......
......@@ -322,9 +322,8 @@ private:
};
public:
DUChainPrivate() : m_chainsMutex(QMutex::Recursive)
, m_cleanupMutex(QMutex::Recursive)
, instance(nullptr)
DUChainPrivate()
: instance(nullptr)
, m_cleanupDisabled(false)
, m_destroyed(false)
, m_environmentListInfo(QStringLiteral("Environment Lists"))
......@@ -452,9 +451,9 @@ public:
///Must be locked before accessing content of this class.
///Should be released during expensive disk-operations and such.
QMutex m_chainsMutex;
QRecursiveMutex m_chainsMutex;
QMutex m_cleanupMutex;
QRecursiveMutex m_cleanupMutex;
CleanupThread* m_cleanup;
......@@ -723,10 +722,7 @@ public:
}
}
QMutex& cleanupMutex()
{
return m_cleanupMutex;
}
QRecursiveMutex& cleanupMutex() { return m_cleanupMutex; }
/// defines how we interact with the ongoing language parse jobs
enum LockFlag {
......
......@@ -77,7 +77,7 @@ DEFINE_LIST_MEMBER_HASH(TopDUContextData, m_usedDeclarationIds, DeclarationId)
DEFINE_LIST_MEMBER_HASH(TopDUContextData, m_problems, LocalIndexedProblem)
REGISTER_DUCHAIN_ITEM(TopDUContext);
QMutex importStructureMutex(QMutex::Recursive);
QRecursiveMutex importStructureMutex;
//Contains data that is not shared among top-contexts that share their duchain entries
class TopDUContextLocalPrivate
......
......@@ -45,7 +45,6 @@ CodeHighlighting::CodeHighlighting(QObject* parent)
: QObject(parent)
, m_localColorization(true)
, m_globalColorization(true)
, m_dataMutex(QMutex::Recursive)
{
qRegisterMetaType<KDevelop::IndexedString>("KDevelop::IndexedString");
......
......@@ -191,7 +191,7 @@ private:
// Should be used to enable/disable the colorization of global types and their uses
bool m_globalColorization;
mutable QMutex m_dataMutex;
mutable QRecursiveMutex m_dataMutex;
private Q_SLOTS:
void clearHighlightingForDocument(const KDevelop::IndexedString& document);
......
......@@ -103,13 +103,12 @@ public:
QString m_path;
QMap<AbstractItemRepository*, AbstractRepositoryManager*> m_repositories;
QMap<QString, QAtomicInt*> m_customCounters;
mutable QMutex m_mutex;
mutable QRecursiveMutex m_mutex;
explicit ItemRepositoryRegistryPrivate(ItemRepositoryRegistry* owner)
: m_owner(owner)
, m_shallDelete(false)
, m_wasShutdown(false)
, m_mutex(QMutex::Recursive)
{
}
......@@ -172,7 +171,7 @@ void ItemRepositoryRegistry::deleteRepositoryFromDisk(const QString& repositoryP
}
}
QMutex& ItemRepositoryRegistry::mutex()
QRecursiveMutex& ItemRepositoryRegistry::mutex()
{
Q_D(ItemRepositoryRegistry);
......
......@@ -12,7 +12,7 @@
#include <QScopedPointer>
class QString;
class QMutex;
class QRecursiveMutex;
class QAtomicInt;
namespace KDevelop {
......@@ -83,7 +83,7 @@ public:
/// @returns The global item-repository mutex.
/// @note Can be used to protect the initialization.
QMutex& mutex();
QRecursiveMutex& mutex();
private:
explicit ItemRepositoryRegistry(const QString& repositoryPath);
......
......@@ -154,8 +154,7 @@ class LanguageControllerPrivate
{
public:
explicit LanguageControllerPrivate(LanguageController *controller)
: dataMutex(QMutex::Recursive)
, backgroundParser(new BackgroundParser(controller))
: backgroundParser(new BackgroundParser(controller))
, staticAssistantsManager(nullptr)
, m_cleanedUp(false)
, problemModelSet(new ProblemModelSet(controller))
......@@ -173,7 +172,7 @@ public:
QList<ILanguageSupport*> activeLanguages;
mutable QMutex dataMutex;
mutable QRecursiveMutex dataMutex;
LanguageHash languages; //Maps language-names to languages
LanguageCache languageCache; //Maps mimetype-names to languages
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment