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
visible: realSource
source: realSource
source: width < 1 ? "" : realSource
sourceSize.width: width
sourceSize.height: width
fillMode: Image.PreserveAspectCrop

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

View File

@ -6,10 +6,10 @@
using QMatrixClient::BaseJob;
ThumbnailResponse::ThumbnailResponse(QMatrixClient::Connection* c,
QString mediaId, const QSize& requestedSize)
QString id, const QSize& size)
: c(c),
mediaId(std::move(mediaId)),
requestedSize(requestedSize),
mediaId(std::move(id)),
requestedSize(size),
errorStr("Image request hasn't started") {
if (requestedSize.isEmpty()) {
errorStr.clear();
@ -40,7 +40,7 @@ void ThumbnailResponse::startRequest() {
void ThumbnailResponse::prepareResult() {
Q_ASSERT(QThread::currentThread() == job->thread());
Q_ASSERT(job->error() != BaseJob::Pending);
Q_ASSERT(job->error() != BaseJob::Pending);
{
QWriteLocker _(&lock);
if (job->error() == BaseJob::Success) {
@ -48,7 +48,7 @@ void ThumbnailResponse::prepareResult() {
errorStr.clear();
} else if (job->error() == BaseJob::Abandoned) {
errorStr = tr("Image request has been cancelled");
qDebug() << "ThumbnailResponse: cancelled for" << mediaId;
qDebug() << "ThumbnailResponse: cancelled for" << mediaId;
} else {
errorStr = job->errorString();
qWarning() << "ThumbnailResponse: no valid image for" << mediaId << "-"
@ -61,9 +61,10 @@ void ThumbnailResponse::prepareResult() {
void ThumbnailResponse::doCancel() {
// Runs in the main thread, not QML thread
Q_ASSERT(QThread::currentThread() == job->thread());
if (job)
job->abandon();
if (job) {
Q_ASSERT(QThread::currentThread() == job->thread());
job->abandon();
}
}
QQuickTextureFactory* ThumbnailResponse::textureFactory() const {
@ -83,6 +84,6 @@ void ThumbnailResponse::cancel() {
QQuickImageResponse* ImageProvider::requestImageResponse(
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);
}