https://bugs.kde.org/show_bug.cgi?id=482668

Jakob Petsovits <jpe...@petsovits.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
      Latest Commit|                            |https://invent.kde.org/plas
                   |                            |ma/powerdevil/-/commit/8ecf
                   |                            |6430ee7a3d3670fd9cb1b6af947
                   |                            |f9ac2f352
             Status|ASSIGNED                    |RESOLVED

--- Comment #14 from Jakob Petsovits <jpe...@petsovits.com> ---
Git commit 8ecf6430ee7a3d3670fd9cb1b6af947f9ac2f352 by Jakob Petsovits.
Committed on 14/03/2024 at 03:19.
Pushed by jpetso into branch 'master'.

kcmodule: Don't crash when a configured button action is unsupported

The bounds check in the data() method of PowerButtonActionModel
and SleepModeModel was incomplete, so passing an invalid index
such as -1 (standard value for "not found") could cause a crash.

For power management settings, a user would run into this crash if
their configuration from powerdevilrc listed a power button action
that's not supported on the current system. For example, a user
may have selected "Sleep" as lid action, but subsequently changed
their systemd configuration to disable suspend-to-RAM because it
caused problems. Or they could have migrated their OS to a new
computer which does not support Sleep.

Fixing this allows us to assign currentIndex declaratively
instead of waiting until Component.onCompleted to (hopefully) find
a valid item in the model.

M  +1    -1    kcmodule/common/PowerButtonActionModel.cpp
M  +1    -1    kcmodule/common/SleepModeModel.cpp
M  +2    -3    kcmodule/profiles/ui/GlobalConfig.qml
M  +8    -12   kcmodule/profiles/ui/ProfileConfig.qml

https://invent.kde.org/plasma/powerdevil/-/commit/8ecf6430ee7a3d3670fd9cb1b6af947f9ac2f352

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to