diff options
author | Andreas Sturmlechner <asturm@gentoo.org> | 2022-07-26 12:56:13 +0200 |
---|---|---|
committer | Andreas Sturmlechner <asturm@gentoo.org> | 2022-07-26 14:04:51 +0200 |
commit | 2645002594bfc5a9f26ada398d863bafbb00da35 (patch) | |
tree | 62d0867de694eef922791ff8322b5952fbd45761 /kde-frameworks/kjobwidgets | |
parent | kde-frameworks/qqc2-desktop-style: ProgressBar/Slider/ToolTip fixes (diff) | |
download | gentoo-2645002594bfc5a9f26ada398d863bafbb00da35.tar.gz gentoo-2645002594bfc5a9f26ada398d863bafbb00da35.tar.bz2 gentoo-2645002594bfc5a9f26ada398d863bafbb00da35.zip |
kde-frameworks/kjobwidgets: Fix ui-server crash
Upstream commit 5aeba3f01ef8cdf723813cacdd29945328288663
KDE-bug: https://bugs.kde.org/show_bug.cgi?id=450325
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Diffstat (limited to 'kde-frameworks/kjobwidgets')
-rw-r--r-- | kde-frameworks/kjobwidgets/files/kjobwidgets-5.96.0-fix-ui-server-crash.patch | 82 | ||||
-rw-r--r-- | kde-frameworks/kjobwidgets/kjobwidgets-5.96.0-r1.ebuild | 42 |
2 files changed, 124 insertions, 0 deletions
diff --git a/kde-frameworks/kjobwidgets/files/kjobwidgets-5.96.0-fix-ui-server-crash.patch b/kde-frameworks/kjobwidgets/files/kjobwidgets-5.96.0-fix-ui-server-crash.patch new file mode 100644 index 000000000000..463daf84f573 --- /dev/null +++ b/kde-frameworks/kjobwidgets/files/kjobwidgets-5.96.0-fix-ui-server-crash.patch @@ -0,0 +1,82 @@ +From 5aeba3f01ef8cdf723813cacdd29945328288663 Mon Sep 17 00:00:00 2001 +From: Michael Pyne <mpyne@kde.org> +Date: Sat, 2 Jul 2022 17:57:10 -0400 +Subject: [PATCH] ui-server: Fix crash by only re-registering live KJobs. + +This addresses a frequently-reported crash in the job tracker for +KUiServerV2 that occurs when attempting to re-register new job views for +active KJobs after a new UI server comes online. + +Although I have not been able to reproduce the crash myself, (by +attempting to use both long-lived and short-lived file transfers from +Dolphin and restarting plasmashell), inspection of the code shows that +it is possible for there to be deleted KJobs pointing to JobView objects +during some portions of the job tracker's lifetime. + +The current code deals with this in situations including DBus calls to +create a U/I view for a KJob (the KJob may terminate before the DBus +reply is received) and even a short delay that can be optionally +introduced (the KJob may terminate before the delay elapses). A +QPointer<KJob> is used as a guard in these situations, but there is no +similar guard for the re-registration code. + +In this case we cannot use QPointer<KJob> to guard the job's lifetime +because the KJob must be alive when the QPointer<KJob> is created, and +this crash occurs when the KJob is terminated. However the KJob's +destruction should lead to the unregisterJob() function being called, +which handles removing the terminated KJob from the map of job views +with only one exception, where instead the job view for the KJob has its +"terminated" pending status set. + +So the fix here checks for the "terminated" state in the same way as +performed in requestView(), and if the KJob is terminated, handles +requesting the job view to terminate the U/I and finally removing the +terminated KJob from the map of job views. + +By doing this, we avoid passing a deleted KJob to the registerJob() +function, which will attempt to dereference it and crash the +application. + +See also merge request !22 + +BUG:450325 +--- + src/kuiserverv2jobtracker.cpp | 20 ++++++++++++++++---- + 1 file changed, 16 insertions(+), 4 deletions(-) + +diff --git a/src/kuiserverv2jobtracker.cpp b/src/kuiserverv2jobtracker.cpp +index 737c880..3592618 100644 +--- a/src/kuiserverv2jobtracker.cpp ++++ b/src/kuiserverv2jobtracker.cpp +@@ -209,12 +209,24 @@ void KUiServerV2JobTracker::registerJob(KJob *job) + + const auto oldState = view.currentState; + +- delete view.jobView; +- d->jobViews.remove(job); ++ // It is possible that the KJob has been deleted already so do not ++ // use or deference if marked as terminated ++ if (oldState.value(QStringLiteral("terminated")).toBool()) { ++ const uint errorCode = oldState.value(QStringLiteral("errorCode")).toUInt(); ++ const QString errorMessage = oldState.value(QStringLiteral("errorMessage")).toString(); + +- registerJob(job); ++ view.jobView->terminate(errorCode, errorMessage, QVariantMap() /*hints*/); + +- d->jobViews[job].currentState = oldState; ++ delete view.jobView; ++ d->jobViews.remove(job); ++ } else { ++ delete view.jobView; ++ d->jobViews.remove(job); // must happen before registerJob ++ ++ registerJob(job); ++ ++ d->jobViews[job].currentState = oldState; ++ } + } + }); + } +-- +GitLab + diff --git a/kde-frameworks/kjobwidgets/kjobwidgets-5.96.0-r1.ebuild b/kde-frameworks/kjobwidgets/kjobwidgets-5.96.0-r1.ebuild new file mode 100644 index 000000000000..d52076a835bf --- /dev/null +++ b/kde-frameworks/kjobwidgets/kjobwidgets-5.96.0-r1.ebuild @@ -0,0 +1,42 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PVCUT=$(ver_cut 1-2) +QTMIN=5.15.4 +inherit ecm frameworks.kde.org + +DESCRIPTION="Framework providing assorted widgets for showing the progress of jobs" + +LICENSE="LGPL-2+" +KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc64 ~riscv ~x86" +IUSE="nls X" + +RDEPEND=" + >=dev-qt/qtdbus-${QTMIN}:5 + >=dev-qt/qtgui-${QTMIN}:5 + >=dev-qt/qtwidgets-${QTMIN}:5 + =kde-frameworks/kcoreaddons-${PVCUT}*:5 + =kde-frameworks/kwidgetsaddons-${PVCUT}*:5 + X? ( >=dev-qt/qtx11extras-${QTMIN}:5 ) +" +DEPEND="${RDEPEND} + X? ( + x11-base/xorg-proto + x11-libs/libX11 + ) +" +BDEPEND=" + nls? ( >=dev-qt/linguist-tools-${QTMIN}:5 ) +" + +PATCHES=( "${FILESDIR}/${P}-fix-ui-server-crash.patch" ) # KDE-bug 450325 + +src_configure() { + local mycmakeargs=( + $(cmake_use_find_package X X11) + ) + + ecm_src_configure +} |