Eclipse case: avoid invalidating vector while iterating over it.

This commit is contained in:
Kristian Bendiksen 2024-04-16 14:21:47 +02:00 committed by Magne Sjaastad
parent abf61090cc
commit 2d688b1c8b

View File

@ -283,11 +283,9 @@ void RimEclipseCase::initAfterRead()
{ {
// Move views to view collection. // Move views to view collection.
RimEclipseViewCollection* viewColl = viewCollection(); RimEclipseViewCollection* viewColl = viewCollection();
for ( size_t j = 0; j < m_reservoirViews_OBSOLETE.size(); j++ ) for ( RimEclipseView* riv : m_reservoirViews_OBSOLETE.childrenByType() )
{ {
RimEclipseView* riv = m_reservoirViews_OBSOLETE()[j];
CVF_ASSERT( riv ); CVF_ASSERT( riv );
riv->setEclipseCase( this ); riv->setEclipseCase( this );
m_reservoirViews_OBSOLETE.removeChild( riv ); m_reservoirViews_OBSOLETE.removeChild( riv );
viewColl->addView( riv ); viewColl->addView( riv );