9939 Temporary fix for crash situation

Crash is seen on application exit
This commit is contained in:
Magne Sjaastad 2023-03-16 13:57:45 +01:00
parent 26c8883761
commit f2fa0ad024

View File

@ -492,11 +492,25 @@ void caf::PdmUiFormLayoutObjectEditor::cleanupBeforeSettingPdmObject()
m_groupBoxes.clear();
for ( auto l : m_layouts )
{
delete l;
l = nullptr;
}
// https://github.com/OPM/ResInsight/issues/9939
//
// The following lines causes crash. m_layouts contains pointers to layouts that are invalid at this point. The
// m_layouts are created for widgets where the labels are located on top of the widget, and this option is rarely
// used. The crash happens on exit every time when a layout has been created.
//
// A crash has also happened during runtime, but is hard to reproduce.
//
// NB! There will be memory leak at this point, but the workaround allowing memory leak is considered OK on short
// term. Investigate and find a correct solution
//
/*
for ( auto l : m_layouts )
{
delete l;
l = nullptr;
}
*/
m_layouts.clear();
}