From 59c1f612fb087be42b67ecfd0227125288c73450 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 6 Nov 2018 10:01:05 +0100 Subject: [PATCH] #3623 Grid Items : Do not try to delete object twice --- .../ProjectDataModel/RimGridCollection.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimGridCollection.cpp b/ApplicationCode/ProjectDataModel/RimGridCollection.cpp index 3c6a0e909b..8706a4976d 100644 --- a/ApplicationCode/ProjectDataModel/RimGridCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimGridCollection.cpp @@ -402,17 +402,16 @@ void RimGridCollection::syncFromMainGrid() } } - while (!allPersistentGrids.empty()) + for (const auto& grid : allPersistentGrids) { - auto gridName = allPersistentGrids.front()->name(); + auto gridName = grid->name(); m_persistentLgrs->deleteGridInfo(gridName); - removeGridInfo(gridName, allPersistentGrids); } - while (!allTemporaryGrids.empty()) + + for (const auto& grid : allTemporaryGrids) { - auto gridName = allTemporaryGrids.front()->name(); - m_temporaryLgrs->deleteGridInfo(allTemporaryGrids.front()->name()); - removeGridInfo(gridName, allTemporaryGrids); + auto gridName = grid->name(); + m_temporaryLgrs->deleteGridInfo(gridName); } } updateConnectedEditors();