Skip to content

Fix memory leaks causing crash on exit

David Edmundson requested to merge work/fix_leaks into master

Someone seems to have changed the lifespan of "Unit" a singleton available as a context property.

This in itself wasn't wrong, but it has exposed some major breakages.

For me right now kquitapp5 plasmashell doesn't exit cleanly. And if plasma doesn't exit cleanly we can really screw up a second log in attempt with a bunch of things left dangling (with the legacy boot especially)

The reason is some QML code is still running at this time the Units singleton (in run_exit_handlers) is destroyed and taking away a context property at runtime is broken.

This patch tries to address why there were any QMLContexts still leaking in the first place.


Fix memory leak of DesktopViews on shutdown

DesktopView's constructor calls PlasmaQuick::ContainmentView(corona,
nullptr), to initialise the parent class. nullptr being the parent.

In this case it makes sense as QWindow's overload of setParent must be a
QWindow, but memory management has to happen somewhere.

Fix memory leak of PanelViews on shutdown

The current code is broken as the course of events is:
 - we delete the containment
- an existing connect to containment deleted goes to
panelContainmentDestroyed
 - this updates m_panelViews and calls deleteLater
 - this deleteLater isn't run before the exit handlers that kills our static units.

Merge request reports