D6608: [PlasmaComponents Menu] Don't crash on null action
Kai Uwe Broulik
noreply at phabricator.kde.org
Mon Jul 10 13:19:35 UTC 2017
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20170710/d93f03f5/attachment.html>
More information about the Plasma-devel
mailing list