D16882: [KDevelop/Shell] prevent duplicate added contextmenu actions
René J.V. Bertin
noreply at phabricator.kde.org
Wed Nov 14 18:36:22 GMT 2018
rjvbb created this revision.
rjvbb added a reviewer: KDevelop.
rjvbb added a project: KDevelop.
rjvbb requested review of this revision.
REVISION SUMMARY
`TextDocument::populateContextMenu()` is called when the user opens the contextmenu but this can happen for more than just the view currently active. When that happens, each view will add its own copy of the list of items to be added to the contextmenu, resulting in duplicate entries.
This patch prevents the consequence of calling `populateContextMenu()` multiple times by checking if the target view is indeed the one currently active in the mainWindow that it belongs to, *after* removing the items from `d->addedContextMenu` from the target `menu`.
Preventing the multiple calls might also be possible but would probably introduce more complexity (connecting and disconnecting `populateContextMenu()` in reaction to `focusIn` and `focusOut` signals?).
This issue can be triggered by loading the Kate CTags plugin (after applying D16779 <https://phabricator.kde.org/D16779>). For an as-yet unknown reason `populateContextMenu()` will be called with every view in which the contextmenu has been opened when the CTags plugin is loaded. A bug in KTextEditor maybe?
TEST PLAN
1- apply D16779 <https://phabricator.kde.org/D16779> to Kate, rebuild and reinstall the kate-ctags plugin
2- load that plugin in KDevelop; observe contextmenu action duplication (once for each document that has opened a contextmenu)
3- apply this patch, rebuild and reinstall libKDevPlatformShell
4- repeat 2, contextmenu is free of duplicates
REPOSITORY
R32 KDevelop
REVISION DETAIL
https://phabricator.kde.org/D16882
AFFECTED FILES
kdevplatform/shell/textdocument.cpp
To: rjvbb, #kdevelop
Cc: kde-frameworks-devel, kdevelop-devel, glebaccon, antismap, iodelay, vbspam, geetamc, Pilzschaf, akshaydeo, surgenight, arrowd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20181114/69d629e4/attachment.html>
More information about the KDevelop-devel
mailing list