#14344 Update ensemble grid model views on polygon import

Include reservoir grid ensemble views in RimProject::allViews() so that
polygon and surface imports update the view tree items and schedule a
redraw for these views.

Make RimReservoirGridEnsemble::allViews() robust against re-entrant
calls during project close by iterating child array fields with
childrenByType(), which skips entries nulled during deleteChildren().
This commit is contained in:
Magne Sjaastad
2026-07-29 15:23:23 +02:00
parent f9c881e442
commit c91e5fa9a7
2 changed files with 27 additions and 7 deletions
@@ -892,6 +892,16 @@ std::vector<Rim3dView*> RimProject::allViews() const
views.push_back( view );
}
}
for ( auto gridEnsemble : oilField->analysisModels()->reservoirGridEnsembles.childrenByType() )
{
if ( !gridEnsemble ) continue;
for ( auto view : gridEnsemble->allViews() )
{
views.push_back( view );
}
}
}
}
@@ -503,20 +503,30 @@ std::vector<RimEclipseView*> RimReservoirGridEnsemble::allViews() const
{
std::vector<RimEclipseView*> views;
for ( auto view : m_viewCollection->views() )
{
views.push_back( view );
}
// Use childrenByType() and null checks here, as this function can be called while child objects
// are being deleted during project close. PdmPointer entries in the child array fields are
// nulled one by one as the objects are destroyed.
for ( auto statCase : m_statisticsCaseCollection->reservoirs() )
if ( m_viewCollection )
{
for ( auto view : statCase->reservoirViews() )
for ( auto view : m_viewCollection->views() )
{
views.push_back( view );
}
}
for ( auto cmap : m_statisticsContourMaps )
if ( m_statisticsCaseCollection )
{
for ( auto statCase : m_statisticsCaseCollection->reservoirs.childrenByType() )
{
for ( auto view : statCase->reservoirViews() )
{
views.push_back( view );
}
}
}
for ( auto cmap : m_statisticsContourMaps.childrenByType() )
{
for ( auto view : cmap->views() )
{