diff --git a/src/clipboard.h b/src/clipboard.h index bd3365cf..7b647c54 100644 --- a/src/clipboard.h +++ b/src/clipboard.h @@ -13,6 +13,8 @@ #include #include #include +#include +#include #include @@ -47,6 +49,8 @@ public: } QImage *qimage() { + QMutexLocker locker(&(this->imageRetrievalLock)); + if (this->cachedImage.isNull()) this->cachedImage = this->clipboard->image(); @@ -99,7 +103,8 @@ signals: private: QClipboard *clipboard = QGuiApplication::clipboard(); - QImage cachedImage = QImage(); + QImage cachedImage = QImage(); + QMutex imageRetrievalLock; void mainClipboardChanged() { this->contentChanged();