mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-24 22:27:55 -05:00
#14722 Remove object from list before deleting it to avoid crash
RicDeleteItemExec::redo() and RicCloseCaseFeature::deleteEclipseCase() deleted the pdm object before removing it from the owning PdmChildArrayField. Destroying the object first could corrupt the field's internal state before the list removal, causing a crash. Swap the order so the object is removed from the list before it is deleted.
This commit is contained in:
1 parent
3f7aee5972
commit
ff7a6be7f4
2 files changed
+3
-3
No files matched your search
@@ -182,8 +182,8 @@ void RicCloseCaseFeature::deleteEclipseCase( RimEclipseCase* eclipseCase )
|
||||
for ( size_t i = children.size(); i-- > 0; )
|
||||
{
|
||||
caf::PdmObjectHandle* obj = children[i];
|
||||
delete obj;
|
||||
caseGroup->statisticsCaseCollection()->reservoirs.erase( i );
|
||||
delete obj;
|
||||
}
|
||||
|
||||
caseGroup->statisticsCaseCollection()->uiCapability()->updateConnectedEditors();
|
||||
|
||||
@@ -62,10 +62,10 @@ void RicDeleteItemExec::redo()
|
||||
m_commandData.m_deletedObjectAsXml = xmlObj( obj )->writeObjectToXmlString();
|
||||
}
|
||||
|
||||
delete obj;
|
||||
|
||||
listField->erase( m_commandData.m_indexToObject );
|
||||
|
||||
delete obj;
|
||||
|
||||
caf::PdmObjectHandle* parentObj = listField->ownerObject();
|
||||
parentObj->uiCapability()->updateConnectedEditors();
|
||||
parentObj->onChildDeleted( listField, referringObjects );
|
||||
|
||||
Reference in new issue
Block a user