Skip to content

Commit

Permalink
Merge pull request #3133 from lilyinstarlight/fix/qt-5-12-qrecursivem…
Browse files Browse the repository at this point in the history
…utex

GUI - fix Qt 5.12 recursive QMutex usage
  • Loading branch information
samaaron authored Jul 12, 2022
2 parents 5aff752 + 3544aa6 commit 9024ae8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/gui/qt/widgets/sonicpiscintilla.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "profiler.h"
#include "sonicpiscintilla.h"
#include "dpi.h"
#include <QRecursiveMutex>
#include <QSettings>
#include <QShortcut>
#include <QDrag>
Expand All @@ -24,6 +23,9 @@
#include <Qsci/qscilexer.h>
#include <QCheckBox>
#include <QRegularExpression>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
#include <QRecursiveMutex>
#endif

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

#if defined(Q_OS_MAC)
int SPi_CTRL = Qt::META;
Expand Down
6 changes: 6 additions & 0 deletions app/gui/qt/widgets/sonicpiscintilla.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
#include "model/sonicpitheme.h"
#include "widgets/sonicpilog.h"
#include <QCheckBox>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
#include <QRecursiveMutex>
#endif

class SonicPiLexer;
class QSettings;
Expand Down Expand Up @@ -88,7 +90,11 @@ class SonicPiScintilla : public QsciScintilla
void dragMoveEvent(QDragMoveEvent *event);
bool event(QEvent *evt);
bool autoIndent;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QRecursiveMutex *mutex;
#else
QMutex *mutex;
#endif

};

Expand Down

0 comments on commit 9024ae8

Please sign in to comment.