commit: 25a3aa4e7b78af49dbcf6c6b79ce08f60a2736ce Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> AuthorDate: Sat Apr 9 15:21:17 2022 +0000 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> CommitDate: Sat Apr 9 16:03:03 2022 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=25a3aa4e
kde-frameworks/kidletime: Fixed crash during KIdleTime::timeoutReached() Upstream commit cd5040684723b87c7ba5b7cc1b1a63402902a641 KDE-bug: https://bugs.kde.org/show_bug.cgi?id=451946 Package-Manager: Portage-3.0.30, Repoman-3.0.3 Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org> .../files/kidletime-5.92.0-crashfix.patch | 41 ++++++++++++++++++ .../kidletime/kidletime-5.92.0-r1.ebuild | 48 ++++++++++++++++++++++ 2 files changed, 89 insertions(+) diff --git a/kde-frameworks/kidletime/files/kidletime-5.92.0-crashfix.patch b/kde-frameworks/kidletime/files/kidletime-5.92.0-crashfix.patch new file mode 100644 index 000000000000..93a016d76fd0 --- /dev/null +++ b/kde-frameworks/kidletime/files/kidletime-5.92.0-crashfix.patch @@ -0,0 +1,41 @@ +From cd5040684723b87c7ba5b7cc1b1a63402902a641 Mon Sep 17 00:00:00 2001 +From: Ada Christine <adachristin...@gmail.com> +Date: Sun, 27 Mar 2022 01:29:09 +0000 +Subject: [PATCH] Fixed crash during KIdleTime::timeoutReached() + +timeoutReached() will cause a crash if an item is removed from associations +during signal dispatch due to iterator invalidation. iterate over a +const container of the assoication keys only triggering ones matching +the current timeout value to avoid the crash and unnecessary copying + +BUG: 451946 +--- + src/kidletime.cpp | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/src/kidletime.cpp b/src/kidletime.cpp +index a58eaa6..0929285 100644 +--- a/src/kidletime.cpp ++++ b/src/kidletime.cpp +@@ -288,13 +288,13 @@ void KIdleTimePrivate::timeoutReached(int msec) + { + Q_Q(KIdleTime); + +- for (auto it = associations.cbegin(); it != associations.cend(); ++it) { +- if (it.value() == msec) { ++ const auto listKeys = associations.keys(msec); ++ ++ for (const auto key : listKeys) { + #if KIDLETIME_BUILD_DEPRECATED_SINCE(5, 76) +- Q_EMIT q->timeoutReached(it.key()); ++ Q_EMIT q->timeoutReached(key); + #endif +- Q_EMIT q->timeoutReached(it.key(), msec); +- } ++ Q_EMIT q->timeoutReached(key, msec); + } + } + +-- +GitLab + diff --git a/kde-frameworks/kidletime/kidletime-5.92.0-r1.ebuild b/kde-frameworks/kidletime/kidletime-5.92.0-r1.ebuild new file mode 100644 index 000000000000..37fdb5a1a54c --- /dev/null +++ b/kde-frameworks/kidletime/kidletime-5.92.0-r1.ebuild @@ -0,0 +1,48 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +ECM_TEST="false" +QTMIN=5.15.2 +inherit ecm kde.org + +DESCRIPTION="Framework for detection and notification of device idle time" +LICENSE="LGPL-2+" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86" +IUSE="X xscreensaver" + +REQUIRED_USE="xscreensaver? ( X )" + +DEPEND=" + >=dev-qt/qtgui-${QTMIN}:5 + X? ( + >=dev-qt/qtx11extras-${QTMIN}:5 + x11-libs/libX11 + x11-libs/libxcb + x11-libs/libXext + ) + xscreensaver? ( + >=dev-qt/qtdbus-${QTMIN}:5 + x11-libs/libXScrnSaver + ) +" +RDEPEND="${DEPEND}" + +PATCHES=( "${FILESDIR}/${P}-crashfix.patch" ) # KDE-bug 451946 + +src_prepare() { + ecm_src_prepare + if ! use xscreensaver; then + sed -i -e "s/\${X11_Xscreensaver_FOUND}/0/" CMakeLists.txt || die + fi +} + +src_configure() { + local mycmakeargs=( + $(cmake_use_find_package X X11) + $(cmake_use_find_package X XCB) + ) + + ecm_src_configure +}