Skip to content

Commit 9024ae8

Browse files
authored
Merge pull request #3133 from lilyinstarlight/fix/qt-5-12-qrecursivemutex
GUI - fix Qt 5.12 recursive QMutex usage
2 parents 5aff752 + 3544aa6 commit 9024ae8

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

app/gui/qt/widgets/sonicpiscintilla.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include "profiler.h"
1515
#include "sonicpiscintilla.h"
1616
#include "dpi.h"
17-
#include <QRecursiveMutex>
1817
#include <QSettings>
1918
#include <QShortcut>
2019
#include <QDrag>
@@ -24,6 +23,9 @@
2423
#include <Qsci/qscilexer.h>
2524
#include <QCheckBox>
2625
#include <QRegularExpression>
26+
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
27+
#include <QRecursiveMutex>
28+
#endif
2729

2830
SonicPiScintilla::SonicPiScintilla(SonicPiLexer *lexer, SonicPiTheme *theme, QString fileName, bool autoIndent)
2931
: QsciScintilla()
@@ -37,7 +39,11 @@ SonicPiScintilla::SonicPiScintilla(SonicPiLexer *lexer, SonicPiTheme *theme, QSt
3739
standardCommands()->clearAlternateKeys();
3840
QString skey;
3941
QSettings settings(QSettings::IniFormat, QSettings::UserScope, "sonic-pi.net", "gui-keys-bindings");
42+
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
4043
mutex = new QRecursiveMutex();
44+
#else
45+
mutex = new QMutex(QMutex::Recursive);
46+
#endif
4147

4248
#if defined(Q_OS_MAC)
4349
int SPi_CTRL = Qt::META;

app/gui/qt/widgets/sonicpiscintilla.h

+6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
#include "model/sonicpitheme.h"
1919
#include "widgets/sonicpilog.h"
2020
#include <QCheckBox>
21+
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
2122
#include <QRecursiveMutex>
23+
#endif
2224

2325
class SonicPiLexer;
2426
class QSettings;
@@ -88,7 +90,11 @@ class SonicPiScintilla : public QsciScintilla
8890
void dragMoveEvent(QDragMoveEvent *event);
8991
bool event(QEvent *evt);
9092
bool autoIndent;
93+
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
9194
QRecursiveMutex *mutex;
95+
#else
96+
QMutex *mutex;
97+
#endif
9298

9399
};
94100

0 commit comments

Comments
 (0)