Fix a crash with newest library
This is basically a replica of
4c0020385a
for Spectral.
This commit is contained in:
@@ -2,23 +2,24 @@
|
||||
#define IMAGEPROVIDER_H
|
||||
#pragma once
|
||||
|
||||
#include <jobs/mediathumbnailjob.h>
|
||||
#include <QThreadPool>
|
||||
#include <QtCore/QAtomicPointer>
|
||||
#include <QtCore/QReadWriteLock>
|
||||
#include <QtQuick/QQuickAsyncImageProvider>
|
||||
#include <QtCore/QAtomicPointer>
|
||||
|
||||
namespace QMatrixClient {
|
||||
class Connection;
|
||||
}
|
||||
|
||||
class ThumbnailResponse : public QQuickImageResponse {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ThumbnailResponse(QMatrixClient::Connection* c, QString mediaId,
|
||||
const QSize& requestedSize);
|
||||
~ThumbnailResponse() override = default;
|
||||
|
||||
private slots:
|
||||
void startRequest();
|
||||
void prepareResult();
|
||||
void doCancel();
|
||||
|
||||
private:
|
||||
QMatrixClient::Connection* c;
|
||||
@@ -28,9 +29,8 @@ class ThumbnailResponse : public QQuickImageResponse {
|
||||
|
||||
QImage image;
|
||||
QString errorStr;
|
||||
mutable QReadWriteLock lock;
|
||||
mutable QReadWriteLock lock; // Guards ONLY these two members above
|
||||
|
||||
void prepareResult();
|
||||
QQuickTextureFactory* textureFactory() const override;
|
||||
QString errorString() const override;
|
||||
void cancel() override;
|
||||
@@ -41,7 +41,7 @@ class ImageProvider : public QObject, public QQuickAsyncImageProvider {
|
||||
Q_PROPERTY(QMatrixClient::Connection* connection READ connection WRITE
|
||||
setConnection NOTIFY connectionChanged)
|
||||
public:
|
||||
explicit ImageProvider() : QObject(), QQuickAsyncImageProvider() {}
|
||||
explicit ImageProvider() = default;
|
||||
|
||||
QQuickImageResponse* requestImageResponse(
|
||||
const QString& id, const QSize& requestedSize) override;
|
||||
@@ -49,6 +49,7 @@ class ImageProvider : public QObject, public QQuickAsyncImageProvider {
|
||||
QMatrixClient::Connection* connection() { return m_connection; }
|
||||
void setConnection(QMatrixClient::Connection* connection) {
|
||||
m_connection.store(connection);
|
||||
emit connectionChanged();
|
||||
}
|
||||
|
||||
signals:
|
||||
|
||||
Reference in New Issue
Block a user