diff --git a/ApplicationCode/Commands/WellLogCommands/RicWellLogFileCloseFeature.cpp b/ApplicationCode/Commands/WellLogCommands/RicWellLogFileCloseFeature.cpp index e5754e3cf1..0dbfca960c 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicWellLogFileCloseFeature.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicWellLogFileCloseFeature.cpp @@ -53,7 +53,7 @@ void RicWellLogFileCloseFeature::onActionTriggered(bool isChecked) if (parentWellPath != nullptr) { - parentWellPath->removeWellLogFile(wellLogFile); + parentWellPath->deleteWellLogFile(wellLogFile); } parentWellPath->updateConnectedEditors(); } diff --git a/ApplicationCode/ProjectDataModel/RimWellPath.cpp b/ApplicationCode/ProjectDataModel/RimWellPath.cpp index 51da29cdea..35de516eed 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPath.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellPath.cpp @@ -653,13 +653,14 @@ void RimWellPath::addWellLogFile(RimWellLogFile* logFileInfo) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellPath::removeWellLogFile(const RimWellLogFile* logFileInfo) +void RimWellPath::deleteWellLogFile(RimWellLogFile* logFileInfo) { + auto pdmObject = dynamic_cast(logFileInfo); for (size_t i = 0; i < m_wellLogFiles.size(); i++) { - if (m_wellLogFiles[i] == logFileInfo) + if (m_wellLogFiles[i] == pdmObject) { - m_wellLogFiles.erase(i); + m_wellLogFiles.removeChildObject(pdmObject); break; } } diff --git a/ApplicationCode/ProjectDataModel/RimWellPath.h b/ApplicationCode/ProjectDataModel/RimWellPath.h index 5d54feb73c..37adfea2a3 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPath.h +++ b/ApplicationCode/ProjectDataModel/RimWellPath.h @@ -65,7 +65,7 @@ public: virtual ~RimWellPath(); void addWellLogFile(RimWellLogFile* logFileInfo); - void removeWellLogFile(const RimWellLogFile* logFileInfo); + void deleteWellLogFile(RimWellLogFile* logFileInfo); virtual caf::PdmFieldHandle* userDescriptionField(); virtual caf::PdmFieldHandle* objectToggleField();