Commit ace53ef4 authored by Albert Astals Cid's avatar Albert Astals Cid

Fix heap-use-after-free in Part destructor

Tear down the ViewManager on the Part destructor instead of letting Qt destroy the child objects itself.

This way we control the sequence more and make sure we don't end up using memory that was already deleted. Fixes the ASAN detected problem in https://build.kde.org/job/konsole%20Applications-15.08%20stable-kf5-qt5/PLATFORM=Linux,compiler=gcc/12/testReport/%28root%29/TestSuite/PartTest/

Neither ASAN nor valgrind complain anymore when running PartTest.

REVIEW: 125366
parent 3810cc47
......@@ -84,6 +84,7 @@ Part::Part(QWidget* parentWidget , QObject* parent, const QVariantList&)
Part::~Part()
{
ProfileManager::instance()->saveSettings();
delete _viewManager;
}
void Part::createGlobalActions()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment