D6769: Proper lifetime support for one-time menu objects with contextMenuExtension
Friedrich W. H. Kossebau
noreply at phabricator.kde.org
Tue Jul 18 11:44:15 UTC 2017
kossebau created this revision.
Restricted Application added a subscriber: kdevelop-devel.
REVISION SUMMARY
For actions and submenus created only for the given context for the menu,
as opposed to persistent context-ignorant actions kept around all the time
and owned by the plugin instance, in IPlugin::contextMenuExtension()
overrides was no access to a QObject/QWidget element which could be used
as QObject-style memory management for the given context menu event.
So the old code for that either used instances like the plugin objects
themselves or even none at all, which both de-facto results in
accumulating lots of out-of-use QActions and QMenus during the runtime
of KDevelop, only to be cleaned up either on destruction of the plugin
instances at process end or never.
Passing to IPlugin::contextMenuExtension a QWidget* object to be used
as memory management parent matching the lifetime of the context menu
allows to fix that.
TEST PLAN
Invoked the context menus changed by the patch, and the temporarily
added slots connected to QObject::destroyed handlers of the
per-context-menu QAction & QMenu objects were invoked at the right time.
No new crashes seen.
REPOSITORY
R33 KDevPlatform
BRANCH
fixcontextmenuleakage
REVISION DETAIL
https://phabricator.kde.org/D6769
AFFECTED FILES
interfaces/context.h
interfaces/iplugin.cpp
interfaces/iplugin.h
interfaces/iplugincontroller.h
language/codegen/basicrefactoring.cpp
language/codegen/basicrefactoring.h
plugins/appwizard/appwizardplugin.cpp
plugins/appwizard/appwizardplugin.h
plugins/bazaar/bazaarplugin.cpp
plugins/bazaar/bazaarplugin.h
plugins/classbrowser/classbrowserplugin.cpp
plugins/classbrowser/classbrowserplugin.h
plugins/classbrowser/classtree.cpp
plugins/contextbrowser/contextbrowser.cpp
plugins/contextbrowser/contextbrowser.h
plugins/contextbrowser/contextbrowserview.cpp
plugins/cvs/cvsplugin.cpp
plugins/cvs/cvsplugin.h
plugins/docker/dockerplugin.cpp
plugins/docker/dockerplugin.h
plugins/documentview/kdevdocumentview.cpp
plugins/externalscript/externalscriptplugin.cpp
plugins/externalscript/externalscriptplugin.h
plugins/filemanager/filemanager.cpp
plugins/filetemplates/filetemplatesplugin.cpp
plugins/filetemplates/filetemplatesplugin.h
plugins/flatpak/flatpakplugin.cpp
plugins/flatpak/flatpakplugin.h
plugins/grepview/grepviewplugin.cpp
plugins/grepview/grepviewplugin.h
plugins/openwith/openwithplugin.cpp
plugins/openwith/openwithplugin.h
plugins/patchreview/patchreview.cpp
plugins/patchreview/patchreview.h
plugins/patchreview/patchreviewtoolview.cpp
plugins/perforce/perforceplugin.cpp
plugins/perforce/perforceplugin.h
plugins/problemreporter/problemreporterplugin.cpp
plugins/problemreporter/problemreporterplugin.h
plugins/projectfilter/projectfilterprovider.cpp
plugins/projectfilter/projectfilterprovider.h
plugins/projectmanagerview/projectbuildsetwidget.cpp
plugins/projectmanagerview/projectmanagerviewplugin.cpp
plugins/projectmanagerview/projectmanagerviewplugin.h
plugins/projectmanagerview/projecttreeview.cpp
plugins/quickopen/quickopenplugin.cpp
plugins/quickopen/quickopenplugin.h
plugins/subversion/kdevsvnplugin.cpp
plugins/subversion/kdevsvnplugin.h
plugins/switchtobuddy/switchtobuddyplugin.cpp
plugins/switchtobuddy/switchtobuddyplugin.h
plugins/vcschangesview/vcschangesview.cpp
shell/debugcontroller.cpp
shell/debugcontroller.h
shell/documentationcontroller.cpp
shell/documentationcontroller.h
shell/plugincontroller.cpp
shell/plugincontroller.h
shell/projectcontroller.cpp
shell/projectcontroller.h
shell/runcontroller.cpp
shell/runcontroller.h
shell/sourceformattercontroller.cpp
shell/sourceformattercontroller.h
shell/textdocument.cpp
tests/testplugincontroller.cpp
tests/testplugincontroller.h
vcs/dvcs/dvcsplugin.cpp
vcs/dvcs/dvcsplugin.h
vcs/vcspluginhelper.cpp
vcs/vcspluginhelper.h
To: kossebau, #kdevelop
Cc: kdevelop-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20170718/1507dfed/attachment-0001.html>
More information about the KDevelop-devel
mailing list