diff options
author | Andreas Sturmlechner <asturm@gentoo.org> | 2023-03-08 11:03:20 +0100 |
---|---|---|
committer | Andreas Sturmlechner <asturm@gentoo.org> | 2023-03-08 12:06:35 +0100 |
commit | d0b8c6544eaa7122509884d82f583cbb61e43786 (patch) | |
tree | 89cbc246f8f468273a30025b9f5f16e6cfcfa835 /dev-qt | |
parent | app-emulation/wine-proton: skip QA for implicit __clear_cache too (diff) | |
download | gentoo-d0b8c6544eaa7122509884d82f583cbb61e43786.tar.gz gentoo-d0b8c6544eaa7122509884d82f583cbb61e43786.tar.bz2 gentoo-d0b8c6544eaa7122509884d82f583cbb61e43786.zip |
dev-qt/qtwidgets: Fix runtime crashes/UB with Ctrl-C
QAbstractItemView: don't access invalid indexes on copy-key
QTBUG: https://bugreports.qt.io/browse/QTBUG-106569
Bug: https://bugs.gentoo.org/900358
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Diffstat (limited to 'dev-qt')
-rw-r--r-- | dev-qt/qtwidgets/files/qtwidgets-5.15.8-QTBUG-106569.patch | 47 | ||||
-rw-r--r-- | dev-qt/qtwidgets/qtwidgets-5.15.8-r3.ebuild | 65 |
2 files changed, 112 insertions, 0 deletions
diff --git a/dev-qt/qtwidgets/files/qtwidgets-5.15.8-QTBUG-106569.patch b/dev-qt/qtwidgets/files/qtwidgets-5.15.8-QTBUG-106569.patch new file mode 100644 index 000000000000..c6ad77e54d44 --- /dev/null +++ b/dev-qt/qtwidgets/files/qtwidgets-5.15.8-QTBUG-106569.patch @@ -0,0 +1,47 @@ +From 9a42df40228d246260cdcd40d2d582a2684439e4 Mon Sep 17 00:00:00 2001 +From: Volker Hilsheimer <volker.hilsheimer@qt.io> +Date: Fri, 10 Feb 2023 14:49:51 +0100 +Subject: [PATCH] QAbstractItemView: don't access invalid indexes on copy-key + +When pressing the copy key the view tried to access the model's data for +the currentIndex() without checking whether the index is valid. This +resulted in debug output to the console, and might break models that +didn't check incoming indexes for validity (or asserted validity). + +Fix this by checking whether the currentIndex() is valid before reading +the model's data for that index. + +Fixes: QTBUG-106569 +Pick-to: 6.5 6.4 6.2 5.15 +Change-Id: Ide75fbdfdbd1451ab6d48f07b22136553c5b2468 +Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> +(cherry picked from commit 3a0c33da3d913431391c5b7f4f0e93ea9d2221dc) +--- + src/widgets/itemviews/qabstractitemview.cpp | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp +index 5e65c59796..774b78dc4f 100644 +--- a/src/widgets/itemviews/qabstractitemview.cpp ++++ b/src/widgets/itemviews/qabstractitemview.cpp +@@ -2338,11 +2338,12 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) + + #if !defined(QT_NO_CLIPBOARD) && !defined(QT_NO_SHORTCUT) + if (event == QKeySequence::Copy) { +- QVariant variant; +- if (d->model) +- variant = d->model->data(currentIndex(), Qt::DisplayRole); +- if (variant.canConvert<QString>()) +- QGuiApplication::clipboard()->setText(variant.toString()); ++ const QModelIndex index = currentIndex(); ++ if (index.isValid() && d->model) { ++ const QVariant variant = d->model->data(index, Qt::DisplayRole); ++ if (variant.canConvert<QString>()) ++ QGuiApplication::clipboard()->setText(variant.toString()); ++ } + event->accept(); + } + #endif +-- +GitLab + diff --git a/dev-qt/qtwidgets/qtwidgets-5.15.8-r3.ebuild b/dev-qt/qtwidgets/qtwidgets-5.15.8-r3.ebuild new file mode 100644 index 000000000000..0c8b74215015 --- /dev/null +++ b/dev-qt/qtwidgets/qtwidgets-5.15.8-r3.ebuild @@ -0,0 +1,65 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +if [[ ${PV} != *9999* ]]; then + QT5_KDEPATCHSET_REV=5 + KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86" +fi + +QT5_MODULE="qtbase" +inherit qt5-build + +DESCRIPTION="Set of components for creating classic desktop-style UIs for the Qt5 framework" + +# keep IUSE defaults in sync with qtgui +IUSE="dbus gles2-only gtk +png +X" +REQUIRED_USE="gtk? ( dbus )" + +DEPEND=" + =dev-qt/qtcore-${QT5_PV}*:5= + =dev-qt/qtgui-${QT5_PV}*:5=[gles2-only=,png=,X?] + dbus? ( =dev-qt/qtdbus-${QT5_PV}* ) + gtk? ( + dev-libs/glib:2 + =dev-qt/qtgui-${QT5_PV}*:5=[dbus] + x11-libs/gtk+:3 + x11-libs/libX11 + x11-libs/pango + ) +" +RDEPEND="${DEPEND}" + +QT5_TARGET_SUBDIRS=( + src/tools/uic + src/widgets + src/plugins/platformthemes +) + +QT5_GENTOO_CONFIG=( + dbus:xdgdesktopportal: + gtk:gtk3: + ::widgets + !:no-widgets: +) + +QT5_GENTOO_PRIVATE_CONFIG=( + :widgets +) + +PATCHES=( "${FILESDIR}/${P}-QTBUG-106569.patch" ) + +src_configure() { + local myconf=( + -opengl $(usex gles2-only es2 desktop) + $(usev dbus -dbus-linked) + $(qt_use gtk) + -gui + $(qt_use png libpng system) + -widgets + $(qt_use X xcb) + $(usev X '-xcb-xlib -xkbcommon') + ) + qt5-build_src_configure +} |