https://bugs.kde.org/show_bug.cgi?id=376693

            Bug ID: 376693
           Summary: QAction objects passed to ContextMenuExtension are
                    leaked
           Product: kdevplatform
           Version: git master
          Platform: Other
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: kdevelop-bugs-n...@kde.org
          Reporter: kosse...@kde.org
  Target Milestone: ---

Many plugins create QAction objects on the fly in their implementation of the
IPlugin::contextMenuExtension() method and then pass on those inside the
returned ContextMenuExtension and forget about them. Just, as the ownership is
not specified, callers of the IPlugin::contextMenuExtension() API do not take
lifetime responsibility themselves for the QAction objects (and QMenu objects).

With noone caring... objects are leaking and accumulating.

On a first look I could not find a simple solution, so for now noting here.

Things to consider:
* Some plugins also pass existing QAction items which are in used elsewhere,
e.g. in the toplevel menu. So simply deleting any QAction objects on
destruction of the ContextMenuExtension instance does not work. Might work to
just delete objects without a parent.
* More, ContextMenuExtension is currently passed by value and is not
explicitely sharing data, so there are many copies of the lists with the
pointers to the QAction objects
* The menus filled by the ContextMenuExtension in the API users might have a
longer lifetime than the ContextMenuExtension objects, that needs some work as
well.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to