From 788865b805bc91151ac8fe18bf7b92b1212ee07d Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 1 Oct 2019 15:09:01 +0200 Subject: Imagine: fix crash when switching between 9-patch and regular image Consider the following changes in source: normal.png => press.9.png => normal.png => focus.png If the last two events happen quickly, pixmapChange() can be called twice with no call to updatePaintNode() inbetween. On the first call, resetNode will be true (because ninePatch is not null since it is still in the process of going from a 9-patch image to a regular image), and on the second call, resetNode would be false if we didn't have this check. This results in the oldNode never being deleted, and QQuickImage tries to static_cast a QQuickNinePatchImage to a QSGInternalImageNode. Only change resetNode when it's false; i.e. when no reset is pending. updatePaintNode() will take care of setting it to false if it's true. Change-Id: I614c172c3e24fda2506f081f8fcdb6acd1c65fb8 Fixes: QTBUG-78790 Reviewed-by: Richard Moe Gustavsen --- src/imports/controls/imagine/qquickninepatchimage.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/imports/controls') diff --git a/src/imports/controls/imagine/qquickninepatchimage.cpp b/src/imports/controls/imagine/qquickninepatchimage.cpp index c840c6f8..7d5e4f71 100644 --- a/src/imports/controls/imagine/qquickninepatchimage.cpp +++ b/src/imports/controls/imagine/qquickninepatchimage.cpp @@ -397,7 +397,24 @@ void QQuickNinePatchImage::pixmapChange() d->updatePatches(); } else { - d->resetNode = !d->ninePatch.isNull(); + /* + Only change resetNode when it's false; i.e. when no reset is pending. + updatePaintNode() will take care of setting it to false if it's true. + + Consider the following changes in source: + + normal.png => press.9.png => normal.png => focus.png + + If the last two events happen quickly, pixmapChange() can be called + twice with no call to updatePaintNode() inbetween. On the first call, + resetNode will be true (because ninePatch is not null since it is still + in the process of going from a 9-patch image to a regular image), + and on the second call, resetNode would be false if we didn't have this check. + This results in the oldNode never being deleted, and QQuickImage + tries to static_cast a QQuickNinePatchImage to a QSGInternalImageNode. + */ + if (!d->resetNode) + d->resetNode = !d->ninePatch.isNull(); d->ninePatch = QImage(); } QQuickImage::pixmapChange(); -- cgit v1.2.3 From 2da83b321f41ce3a9581447e0209c9b827c2c397 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Wed, 9 Oct 2019 14:06:58 +0200 Subject: Universal: disable wrapping for TabBar The wrapping behavior makes for a poor user experience. Use ListView as other styles do. [ChangeLog][Universal][TabBar] Disabled wrapping. The Universal style TabBar now behaves like TabBar from other styles. Change-Id: I0a37490cdc2b81ff864ec682256f469a1a930628 Fixes: QTBUG-50027 Reviewed-by: Andy Shaw --- src/imports/controls/universal/TabBar.qml | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'src/imports/controls') diff --git a/src/imports/controls/universal/TabBar.qml b/src/imports/controls/universal/TabBar.qml index ab660c93..c7d27cbd 100644 --- a/src/imports/controls/universal/TabBar.qml +++ b/src/imports/controls/universal/TabBar.qml @@ -46,23 +46,20 @@ T.TabBar { implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, contentHeight + topPadding + bottomPadding) - contentItem: PathView { + contentItem: ListView { model: control.contentModel currentIndex: control.currentIndex - interactive: false - snapMode: PathView.SnapToItem - movementDirection: PathView.Positive - highlightMoveDuration: 100 + spacing: control.spacing + orientation: ListView.Horizontal + boundsBehavior: Flickable.StopAtBounds + flickableDirection: Flickable.AutoFlickIfNeeded + snapMode: ListView.SnapToItem - path: Path { - startX: control.count ? control.availableWidth / control.count / 2 : 0 - startY: control.availableHeight / 2 - PathLine { - x: control.count ? control.availableWidth + (control.availableWidth / control.count / 2) : 0 - y: control.availableHeight / 2 - } - } + highlightMoveDuration: 100 + highlightRangeMode: ListView.ApplyRange + preferredHighlightBegin: 48 + preferredHighlightEnd: width - 48 } background: Rectangle { -- cgit v1.2.3