#9183 Do not use undo/redo for GeoMech result definition

This commit is contained in:
Magne Sjaastad 2022-08-11 13:04:16 +02:00
parent 806e7672e4
commit 98df56280e
2 changed files with 15 additions and 0 deletions

View File

@ -473,6 +473,20 @@ void RimGeoMechResultDefinition::calculateNormalizationAirGapDefault()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimGeoMechResultDefinition::useUndoRedoForFieldChanged()
{
// Do not use undo/redo, because a state variable is initialized in fieldChanged(), and the undo/redo framework
// trigger a call to defineUiOrdering() before fieldChanged causing invalid state in this object.
// Having a state variable in fieldChanged/defineUiOrdering is a fragile pattern and should be avoided
// See CmdFieldChangeExec::redo()
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -98,6 +98,7 @@ private:
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
void calculateNormalizationAirGapDefault();
bool useUndoRedoForFieldChanged() override;
void initAfterRead() override;
void defineEditorAttribute( const caf::PdmFieldHandle* field,