commit:     4338fbe801992804b4bf84e14500ead09d810182
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 28 14:14:18 2019 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Thu Feb 28 14:14:18 2019 +0000
URL:        https://gitweb.gentoo.org/proj/qt.git/commit/?id=4338fbe8

dev-qt/qtquickcontrols: Fix div by zero

KDE-Bug: https://bugs.kde.org/show_bug.cgi?id=403978#c21
Qt-Bug: https://bugreports.qt.io/browse/QTBUG-73691
See also: https://codereview.qt-project.org/#/c/254226/

Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
Package-Manager: Portage-2.3.51, Repoman-2.3.11

 ...ntrols-5.12.1-scrollviewstyle-div-by-zero.patch | 34 ++++++++++++++++++++++
 .../qtquickcontrols-5.12.1-r1.ebuild               | 34 ++++++++++++++++++++++
 2 files changed, 68 insertions(+)

diff --git 
a/dev-qt/qtquickcontrols/files/qtquickcontrols-5.12.1-scrollviewstyle-div-by-zero.patch
 
b/dev-qt/qtquickcontrols/files/qtquickcontrols-5.12.1-scrollviewstyle-div-by-zero.patch
new file mode 100644
index 00000000..b58f26ac
--- /dev/null
+++ 
b/dev-qt/qtquickcontrols/files/qtquickcontrols-5.12.1-scrollviewstyle-div-by-zero.patch
@@ -0,0 +1,34 @@
+From c231395eec3494619f4977b4c5cd845b9d7341ae Mon Sep 17 00:00:00 2001
+From: Benjamin Robin <[email protected]>
+Date: Sun, 24 Feb 2019 10:28:14 +0100
+Subject: [PATCH] ScrollViewStyle: Avoid division by zero in extent computation
+
+If the flickableItem content is empty (contentWidth / contentHeight is
+equal to 0), prevent the division by zero in the computation of the
+extent variable.
+
+Task-number: QTBUG-73691
+Change-Id: I86becca9a1fa2508d1acafe09f46dfc952e4e96d
+Reviewed-by: Mitch Curtis <[email protected]>
+---
+ src/controls/Styles/Base/ScrollViewStyle.qml | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/controls/Styles/Base/ScrollViewStyle.qml 
b/src/controls/Styles/Base/ScrollViewStyle.qml
+index 6750399d4..36b518d39 100644
+--- a/src/controls/Styles/Base/ScrollViewStyle.qml
++++ b/src/controls/Styles/Base/ScrollViewStyle.qml
+@@ -370,8 +370,8 @@ Style {
+ 
+         property var flickableItem: control.flickableItem
+         property int extent: Math.max(minimumHandleLength, 
__styleData.horizontal ?
+-                                          Math.min(1, (flickableItem ? 
flickableItem.width/flickableItem.contentWidth : 1)) * bg.width :
+-                                          Math.min(1, (flickableItem ? 
flickableItem.height/flickableItem.contentHeight : 1)) * bg.height)
++                                          Math.min(1, ((flickableItem && 
flickableItem.contentWidth > 0.0) ? 
flickableItem.width/flickableItem.contentWidth : 1)) * bg.width :
++                                          Math.min(1, ((flickableItem && 
flickableItem.contentHeight > 0.0) ? 
flickableItem.height/flickableItem.contentHeight : 1)) * bg.height)
+         readonly property real range: __control.maximumValue - 
__control.minimumValue
+         readonly property real begin: __control.value - __control.minimumValue
+ 
+-- 
+2.16.3
+

diff --git a/dev-qt/qtquickcontrols/qtquickcontrols-5.12.1-r1.ebuild 
b/dev-qt/qtquickcontrols/qtquickcontrols-5.12.1-r1.ebuild
new file mode 100644
index 00000000..a2971f97
--- /dev/null
+++ b/dev-qt/qtquickcontrols/qtquickcontrols-5.12.1-r1.ebuild
@@ -0,0 +1,34 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+inherit qt5-build
+
+DESCRIPTION="Set of Qt Quick controls to create complete user interfaces 
(deprecated)"
+
+if [[ ${QT5_BUILD_TYPE} == release ]]; then
+       KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~x86"
+fi
+
+IUSE="+widgets"
+
+DEPEND="
+       ~dev-qt/qtcore-${PV}
+       ~dev-qt/qtdeclarative-${PV}
+       ~dev-qt/qtgui-${PV}
+       widgets? ( ~dev-qt/qtwidgets-${PV} )
+"
+RDEPEND="${DEPEND}"
+
+PATCHES=( "${FILESDIR}/${P}-scrollviewstyle-div-by-zero.patch" )
+
+src_prepare() {
+       qt_use_disable_mod widgets widgets \
+               src/src.pro \
+               src/controls/Private/private.pri \
+               tests/auto/activeFocusOnTab/activeFocusOnTab.pro \
+               tests/auto/controls/controls.pro \
+               tests/auto/testplugin/testplugin.pro
+
+       qt5-build_src_prepare
+}

Reply via email to