fix: read plasmashell version more reliably

In some cases, `plasmashell -v` crashes, which makes `readAllStandardOutput`
fail, although the version is printed out by the process before crashing.
See https://bugs.kde.org/show_bug.cgi?id=467696 and
https://bugreports.qt.io/browse/QTBUG-112258 for the details of the crash.

Instead, read the libtaskmanager version from CMake, which is much more
reliable.
work/fuf/qt6
Aroun Olorin 2 years ago committed by Nate Graham
parent 06fbe1fd4d
commit 4f93251d8c

@ -26,3 +26,4 @@ Dependencies:
'frameworks/kwayland': '@latest'
'frameworks/kwindowsystem': '@latest'
'frameworks/kxmlgui': '@latest'
'plasma/plasma-workspace': '@same'

@ -36,6 +36,9 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
Activities Archive CoreAddons GuiAddons Crash DBusAddons Declarative GlobalAccel Kirigami2
I18n IconThemes KIO NewStuff Notifications Plasma PlasmaQuick Wayland WindowSystem XmlGui)
find_package(LibTaskManager REQUIRED)
add_definitions(-DPLASMA_WORKSPACE_VERSION="${LibTaskManager_VERSION}")
find_package(X11 REQUIRED)
set_package_properties(X11 PROPERTIES DESCRIPTION "X11 libraries"
URL "http://www.x.org"

@ -61,25 +61,15 @@ uint Environment::makeVersion(uint major, uint minor, uint release) const
uint Environment::identifyPlasmaDesktopVersion()
{
//! Identify Plasma Desktop version
QProcess process;
process.start("plasmashell", QStringList() << "-v");
process.waitForFinished();
QString output(process.readAllStandardOutput());
QStringList stringSplit = output.split(" ");
if (stringSplit.count() >= 2) {
qDebug() << " /////////////////////////";
QString cleanVersionString = stringSplit[1].remove("\n");
QStringList plasmaDesktopVersionParts = cleanVersionString.split(".");
QStringList plasmaDesktopVersionParts = QString(PLASMA_WORKSPACE_VERSION).split(".");
if (plasmaDesktopVersionParts.count() == 3) {
qDebug() << " /////////////////////////";
uint maj = plasmaDesktopVersionParts[0].toUInt();
uint min = plasmaDesktopVersionParts[1].toUInt();
uint rel = plasmaDesktopVersionParts[2].toUInt();
if (maj > 0) {
uint desktopVersion = makeVersion(maj, min, rel);
QString message("Plasma Desktop version: " + QString::number(maj) + "."
@ -90,7 +80,6 @@ uint Environment::identifyPlasmaDesktopVersion()
return desktopVersion;
}
}
qDebug() << " /////////////////////////";
}

Loading…
Cancel
Save