From 4d452d5dff2d12a9a44277798f2a70902a3d1891 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 23 Oct 2017 15:19:09 +0200 Subject: QQuickIconImage: fix crash with image providers QQuickImageBase::load() cannot call until the component creation is completed, because it requires an associated QML engine. All calls to updateIcon() are guarded with the appropriate isComponentComplete() check, but the sourceSizeChanged() signal was connected directly to updateIcon(). Establish the signal-slot connection at component completion to avoid calling updateIcon() to soon. Task-number: QTBUG-63959 Change-Id: I3c935291796dbae031d2728e1d51c55596a51cd0 Reviewed-by: Mitch Curtis --- src/quickcontrols2/qquickiconimage.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/quickcontrols2/qquickiconimage.cpp b/src/quickcontrols2/qquickiconimage.cpp index c628c7ae..885bc7f9 100644 --- a/src/quickcontrols2/qquickiconimage.cpp +++ b/src/quickcontrols2/qquickiconimage.cpp @@ -125,9 +125,7 @@ qreal QQuickIconImagePrivate::calculateDevicePixelRatio() const QQuickIconImage::QQuickIconImage(QQuickItem *parent) : QQuickImage(*(new QQuickIconImagePrivate), parent) { - Q_D(QQuickIconImage); setFillMode(Pad); - QObjectPrivate::connect(this, &QQuickImageBase::sourceSizeChanged, d, &QQuickIconImagePrivate::updateIcon); } QString QQuickIconImage::name() const @@ -183,6 +181,7 @@ void QQuickIconImage::componentComplete() Q_D(QQuickIconImage); QQuickImage::componentComplete(); d->updateIcon(); + QObjectPrivate::connect(this, &QQuickImageBase::sourceSizeChanged, d, &QQuickIconImagePrivate::updateIcon); } void QQuickIconImage::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) -- cgit v1.2.3