diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcPolygonCollection.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcPolygonCollection.cpp index dd1873f3e0..058c04cd35 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcPolygonCollection.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcPolygonCollection.cpp @@ -48,7 +48,7 @@ caf::PdmObjectHandle* RimcPolygonCollection_createPolygon::execute() QString name = m_name(); std::vector coords = m_coordinates(); - RimPolygon* polygon = polygonCollection->appendUserDefinedPolygon(); + RimPolygon* polygon = new RimPolygon(); if ( !name.isEmpty() ) { polygon->setName( name ); @@ -56,6 +56,7 @@ caf::PdmObjectHandle* RimcPolygonCollection_createPolygon::execute() polygon->setPointsInDomainCoords( coords ); + polygonCollection->addUserDefinedPolygon( polygon ); polygonCollection->updateConnectedEditors(); return polygon;