Fix use after free in RadialMap::Widget::invalidate()

Authored by janus on Mar 4 2019, 4:04 PM.

Description

Fix use after free in RadialMap::Widget::invalidate()

Summary:
Emit aboutToEmptyCache to invoke RadialMap::Widget::invalidate(),
so folder can be safely deleted.

If "Scan across system boundaries" isn't set and there is mountpoint B
contained in another mountpoint A, user may trigger segfault if scan of
A and then B is requested. It is caused by call of MainWindow class to
m_map->invalidate() method, which is invoked after m_map's m_tree member
is deleted during ScanManager::start method.

This fix causes that RadialMap::Widget::invalidate() is called twice in
fact, however second call is fine, because "invalidate" is guarded by
"isValid" method.

BUG: 389119

Reviewers: sitter, sandsmark

Reviewed By: sitter

Subscribers: kde-utils-devel

Differential Revision: https://phabricator.kde.org/D11188

Details