applets/desktoptheme: Protect against setting infinity size

Reason for the change

While the SVG item is getting loaded, it can temporary report an empty naturalSize.

Without a check, the operation would result in svgScale set to Infinity, and in turn also the size of several items.

Due to QTBUG-144138 this behavior will also trigger an assert down the chain, and will likely be not allowed in a future Qt release. See: https://codereview.qt-project.org/c/qt/qtdeclarative/+/620752

  • Second commit, while at it: Remove unused properties

Test plan

Launch the KCM compiled to crash on failed asserts (-DCMAKE_BUILD_TYPE=Debug or -DQT_FORCE_ASSERTS=ON)

Without this MR it crashes on launch.

With some debug lines added on the property changes:

BEFORE

qml: theme:air naturalSize:QSizeF(0, 0) svgScale:-Infinity
qml: theme:air naturalSize:QSizeF(0, 0) svgScale:NaN
qml: theme:air naturalSize:QSizeF(0, 0) svgScale:NaN
qml: theme:air naturalSize:QSizeF(0, 0) svgScale:NaN
qml: theme:air naturalSize:QSizeF(0, 0) svgScale:Infinity
ASSERT: "value < maximalPlusOne" in file /home/isma/kde/usr/include/QtCore/qnumeric.h, line 516
[1]    2494197 IOT instruction (core dumped)  kcmshell6 kcm_desktoptheme

AFTER

qml: theme:air naturalSize:QSizeF(0, 0) svgScale:1
qml: theme:air naturalSize:QSizeF(200, 200) svgScale:0.365

Second commit, while at it: Remove unused properties

Edited by Nate Graham

Merge request reports

Loading