#12599 Call hide on editor to trigger cleanup

Trigger a hide event the editor to allow it to clean up. This is required to persist the changes in the editor when changing to a different dock widget.
This commit is contained in:
Magne Sjaastad committed 2025-06-17 13:13:32 +02:00
1 parent ea9f0e0c81
commit a5d010fe60
1 file changed
+12 -2
@@ -492,8 +492,18 @@ void caf::PdmUiFormLayoutObjectEditor::cleanupBeforeSettingPdmObject()
std::map<PdmFieldHandle*, PdmUiFieldEditorHandle*>::iterator it;
for ( it = m_fieldViews.begin(); it != m_fieldViews.end(); ++it )
{
PdmUiFieldEditorHandle* fvh = it->second;
delete fvh;
if ( PdmUiFieldEditorHandle* fvh = it->second )
{
if ( auto editor = fvh->editorWidget() )
{
// Trigger a hide event the editor to allow it to clean up. This is required to persist the changes in
// the editor when changing to a different dock widget.
// https://github.com/OPM/ResInsight/issues/12599
editor->hide();
}
delete fvh;
}
}
m_fieldViews.clear();