Skip to content

Fix kcm_solid_actions crash by expecting QList item relocation

In Qt 6, QList is synonymous with QVector and has different behavior in terms of item storage compared to Qt 5. In this particular case, ActionItem relied on the fact that list items in configGroups would always retain the same address as when initially inserted. This assumption turns out to be wrong, the item gets moved and the original address is now an invalid dangling pointer.

In order to avoid crashes from dereferencing invalid pointers, we can store the index of the item in configGroups instead of its address. ActionItem::configItem() gets reshuffled a little bit to accommodate for this change, and also for some extra clarity.

As a result, the KCM now starts again without crashing.


So much for the commit message. The code could likely be cleaned up some more, and I might look into modernizing the solid_actions folder a bit, but that can go into a different MR later on.

And yes, I had never encountered this somewhat weird KCM in System Settings before, although turns out it's actually there! One has to look deep to figure out why there are a bunch of ostensibly duplicate items in that list by default. Perhaps a candidate for improved UX one day.

Merge request reports