Use QRecursiveMutex instead of QMutex in CppParser

This commit is contained in:
Roy Qu 2023-10-10 19:59:39 +08:00
parent 571f18ee54
commit 526e73d27a
3 changed files with 11 additions and 2 deletions

View File

@ -29,7 +29,12 @@
static QAtomicInt cppParserCount(0);
CppParser::CppParser(QObject *parent) : QObject(parent)
CppParser::CppParser(QObject *parent) : QObject(parent),
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
mMutex()
#else
mMutex(QMutex::Recursive)
#endif
{
mParserId = cppParserCount.fetchAndAddRelaxed(1);
mLanguage = ParserLanguage::CPlusPlus;

View File

@ -713,7 +713,11 @@ private:
#ifdef QT_DEBUG
int mLastIndex;
#endif
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
QRecursiveMutex mMutex;
#else
QMutex mMutex;
#endif
QMap<QString,KeywordType> mCppKeywords;
QSet<QString> mCppTypeKeywords;
};

View File

@ -861,7 +861,7 @@ int QSynEdit::charToColumn(const QString &s, int aChar) const
int QSynEdit::columnToChar(int aLine, int aColumn) const
{
Q_ASSERT( (aLine <= mDocument->count()) && (aLine >= 1));
//Q_ASSERT( (aLine <= mDocument->count()) && (aLine >= 1));
if (aLine <= mDocument->count()) {
QString s = getDisplayStringAtLine(aLine);
int x = 0;