Gentoo Archives: gentoo-commits

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: kde-frameworks/kidletime/, kde-frameworks/kidletime/files/
Date: Sat, 09 Apr 2022 16:07:48
Message-Id: 1649520183.25a3aa4e7b78af49dbcf6c6b79ce08f60a2736ce.asturm@gentoo
1 commit: 25a3aa4e7b78af49dbcf6c6b79ce08f60a2736ce
2 Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
3 AuthorDate: Sat Apr 9 15:21:17 2022 +0000
4 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
5 CommitDate: Sat Apr 9 16:03:03 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=25a3aa4e
7
8 kde-frameworks/kidletime: Fixed crash during KIdleTime::timeoutReached()
9
10 Upstream commit cd5040684723b87c7ba5b7cc1b1a63402902a641
11 KDE-bug: https://bugs.kde.org/show_bug.cgi?id=451946
12
13 Package-Manager: Portage-3.0.30, Repoman-3.0.3
14 Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
15
16 .../files/kidletime-5.92.0-crashfix.patch | 41 ++++++++++++++++++
17 .../kidletime/kidletime-5.92.0-r1.ebuild | 48 ++++++++++++++++++++++
18 2 files changed, 89 insertions(+)
19
20 diff --git a/kde-frameworks/kidletime/files/kidletime-5.92.0-crashfix.patch b/kde-frameworks/kidletime/files/kidletime-5.92.0-crashfix.patch
21 new file mode 100644
22 index 000000000000..93a016d76fd0
23 --- /dev/null
24 +++ b/kde-frameworks/kidletime/files/kidletime-5.92.0-crashfix.patch
25 @@ -0,0 +1,41 @@
26 +From cd5040684723b87c7ba5b7cc1b1a63402902a641 Mon Sep 17 00:00:00 2001
27 +From: Ada Christine <adachristine18@×××××.com>
28 +Date: Sun, 27 Mar 2022 01:29:09 +0000
29 +Subject: [PATCH] Fixed crash during KIdleTime::timeoutReached()
30 +
31 +timeoutReached() will cause a crash if an item is removed from associations
32 +during signal dispatch due to iterator invalidation. iterate over a
33 +const container of the assoication keys only triggering ones matching
34 +the current timeout value to avoid the crash and unnecessary copying
35 +
36 +BUG: 451946
37 +---
38 + src/kidletime.cpp | 10 +++++-----
39 + 1 file changed, 5 insertions(+), 5 deletions(-)
40 +
41 +diff --git a/src/kidletime.cpp b/src/kidletime.cpp
42 +index a58eaa6..0929285 100644
43 +--- a/src/kidletime.cpp
44 ++++ b/src/kidletime.cpp
45 +@@ -288,13 +288,13 @@ void KIdleTimePrivate::timeoutReached(int msec)
46 + {
47 + Q_Q(KIdleTime);
48 +
49 +- for (auto it = associations.cbegin(); it != associations.cend(); ++it) {
50 +- if (it.value() == msec) {
51 ++ const auto listKeys = associations.keys(msec);
52 ++
53 ++ for (const auto key : listKeys) {
54 + #if KIDLETIME_BUILD_DEPRECATED_SINCE(5, 76)
55 +- Q_EMIT q->timeoutReached(it.key());
56 ++ Q_EMIT q->timeoutReached(key);
57 + #endif
58 +- Q_EMIT q->timeoutReached(it.key(), msec);
59 +- }
60 ++ Q_EMIT q->timeoutReached(key, msec);
61 + }
62 + }
63 +
64 +--
65 +GitLab
66 +
67
68 diff --git a/kde-frameworks/kidletime/kidletime-5.92.0-r1.ebuild b/kde-frameworks/kidletime/kidletime-5.92.0-r1.ebuild
69 new file mode 100644
70 index 000000000000..37fdb5a1a54c
71 --- /dev/null
72 +++ b/kde-frameworks/kidletime/kidletime-5.92.0-r1.ebuild
73 @@ -0,0 +1,48 @@
74 +# Copyright 1999-2022 Gentoo Authors
75 +# Distributed under the terms of the GNU General Public License v2
76 +
77 +EAPI=8
78 +
79 +ECM_TEST="false"
80 +QTMIN=5.15.2
81 +inherit ecm kde.org
82 +
83 +DESCRIPTION="Framework for detection and notification of device idle time"
84 +LICENSE="LGPL-2+"
85 +KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86"
86 +IUSE="X xscreensaver"
87 +
88 +REQUIRED_USE="xscreensaver? ( X )"
89 +
90 +DEPEND="
91 + >=dev-qt/qtgui-${QTMIN}:5
92 + X? (
93 + >=dev-qt/qtx11extras-${QTMIN}:5
94 + x11-libs/libX11
95 + x11-libs/libxcb
96 + x11-libs/libXext
97 + )
98 + xscreensaver? (
99 + >=dev-qt/qtdbus-${QTMIN}:5
100 + x11-libs/libXScrnSaver
101 + )
102 +"
103 +RDEPEND="${DEPEND}"
104 +
105 +PATCHES=( "${FILESDIR}/${P}-crashfix.patch" ) # KDE-bug 451946
106 +
107 +src_prepare() {
108 + ecm_src_prepare
109 + if ! use xscreensaver; then
110 + sed -i -e "s/\${X11_Xscreensaver_FOUND}/0/" CMakeLists.txt || die
111 + fi
112 +}
113 +
114 +src_configure() {
115 + local mycmakeargs=(
116 + $(cmake_use_find_package X X11)
117 + $(cmake_use_find_package X XCB)
118 + )
119 +
120 + ecm_src_configure
121 +}