Update libqmatrixclient && fix image provider crashes.

This commit is contained in:
Black Hat 2019-03-02 15:33:37 +08:00
parent b5644cb07c
commit 6eb7f21090
3 changed files with 12 additions and 11 deletions

View File

@ -14,7 +14,7 @@ Item {
id: image id: image
visible: realSource visible: realSource
source: realSource source: width < 1 ? "" : realSource
sourceSize.width: width sourceSize.width: width
sourceSize.height: width sourceSize.height: width
fillMode: Image.PreserveAspectCrop fillMode: Image.PreserveAspectCrop

@ -1 +1 @@
Subproject commit 23bf0e83aec1adaf81d9c50ce2385a98c20e3c93 Subproject commit b467b0816f5f6816778f90b55a9d0b5437310fd5

View File

@ -6,10 +6,10 @@
using QMatrixClient::BaseJob; using QMatrixClient::BaseJob;
ThumbnailResponse::ThumbnailResponse(QMatrixClient::Connection* c, ThumbnailResponse::ThumbnailResponse(QMatrixClient::Connection* c,
QString mediaId, const QSize& requestedSize) QString id, const QSize& size)
: c(c), : c(c),
mediaId(std::move(mediaId)), mediaId(std::move(id)),
requestedSize(requestedSize), requestedSize(size),
errorStr("Image request hasn't started") { errorStr("Image request hasn't started") {
if (requestedSize.isEmpty()) { if (requestedSize.isEmpty()) {
errorStr.clear(); errorStr.clear();
@ -61,10 +61,11 @@ void ThumbnailResponse::prepareResult() {
void ThumbnailResponse::doCancel() { void ThumbnailResponse::doCancel() {
// Runs in the main thread, not QML thread // Runs in the main thread, not QML thread
if (job) {
Q_ASSERT(QThread::currentThread() == job->thread()); Q_ASSERT(QThread::currentThread() == job->thread());
if (job)
job->abandon(); job->abandon();
} }
}
QQuickTextureFactory* ThumbnailResponse::textureFactory() const { QQuickTextureFactory* ThumbnailResponse::textureFactory() const {
QReadLocker _(&lock); QReadLocker _(&lock);
@ -83,6 +84,6 @@ void ThumbnailResponse::cancel() {
QQuickImageResponse* ImageProvider::requestImageResponse( QQuickImageResponse* ImageProvider::requestImageResponse(
const QString& id, const QSize& requestedSize) { const QString& id, const QSize& requestedSize) {
qDebug() << "ImageProvider: requesting " << id; qDebug() << "ImageProvider: requesting " << id << "of size" << requestedSize;
return new ThumbnailResponse(m_connection.load(), id, requestedSize); return new ThumbnailResponse(m_connection.load(), id, requestedSize);
} }