broulik created this revision. Restricted Application added projects: Plasma, Frameworks. Restricted Application added subscribers: Frameworks, plasma-devel.
REVISION SUMMARY You can assign a `QAction` as "action", this way you can just pass it e.g. `plasmoid.action("configure")`. However, when assigning a `null` action as can happen with kiosk restrictions, it would crash as it assigns `m_action` the `nullptr` but never checks for that. This patch ensures we always have a `QAction`, keeping the one we created ourselves, if neccessary. Also deletes our own action if an external one is assigned TEST PLAN Created a menu and applied `plasma/plasmashell/unlockedDesktop=false` and opened it, no longer crashes: PlasmaComponents.ContextMenu { id: contextMenu PlasmaComponents.MenuItem { action: plasmoid.action("configure") } } Manual test has a new button to test this. F3808090: Screenshot_20170710_151842.png <https://phabricator.kde.org/F3808090> REPOSITORY R242 Plasma Framework (Library) REVISION DETAIL https://phabricator.kde.org/D6608 AFFECTED FILES src/declarativeimports/plasmacomponents/qmenuitem.cpp src/declarativeimports/plasmacomponents/qmenuitem.h tests/components/menu.qml To: broulik, #plasma Cc: plasma-devel, #frameworks, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart, lukas