SSIHUB: Fixed memory leak

Delete copy of RimWellPathImport object and added destructor to related
objects
This commit is contained in:
Magne Sjaastad 2013-10-23 10:42:34 +02:00
parent 785efe55e8
commit cbe9110c8a
7 changed files with 37 additions and 6 deletions

View File

@ -1657,11 +1657,11 @@ void RiuMainWindow::slotImportWellPathsFromSSIHub()
wellPathsFolderPath += "/" + wellPathFolderName;
RimWellPathImport* copyOfWellPathImport = dynamic_cast<RimWellPathImport*>(app->project()->wellPathImport->deepCopy());
RiuWellImportWizard wellImportwizard(app->preferences()->ssihubAddress, wellPathsFolderPath, copyOfWellPathImport, this);
RimWellPathImport* wellPathObjectToBeDeleted = NULL;
// Get password/username from application cache
{
QString ssihubUsername = app->cacheDataObject("ssihub_username").toString();
@ -1679,11 +1679,18 @@ void RiuMainWindow::slotImportWellPathsFromSSIHub()
app->project()->createDisplayModelAndRedrawAllViews();
}
wellPathObjectToBeDeleted = app->project()->wellPathImport;
app->project()->wellPathImport = copyOfWellPathImport;
app->setCacheDataObject("ssihub_username", wellImportwizard.field("username"));
app->setCacheDataObject("ssihub_password", wellImportwizard.field("password"));
}
else
{
wellPathObjectToBeDeleted = copyOfWellPathImport;
}
delete wellPathObjectToBeDeleted;
}
//--------------------------------------------------------------------------------------------------

View File

@ -48,6 +48,14 @@ RimOilFieldEntry::RimOilFieldEntry()
CAF_PDM_InitFieldNoDefault(&wells, "Wells", "", "", "", "");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimOilFieldEntry::~RimOilFieldEntry()
{
wells.deleteAllChildObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -116,4 +124,3 @@ RimWellPathEntry* RimOilFieldEntry::find(const QString& name, RimWellPathEntry::
return NULL;
}

View File

@ -31,6 +31,7 @@ class RimOilFieldEntry : public caf::PdmObject
public:
RimOilFieldEntry();
~RimOilFieldEntry();
caf::PdmField<QString> name;

View File

@ -38,6 +38,14 @@ RimOilRegionEntry::RimOilRegionEntry()
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimOilRegionEntry::~RimOilRegionEntry()
{
fields.deleteAllChildObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -77,5 +85,3 @@ void RimOilRegionEntry::updateState()
}
}

View File

@ -32,6 +32,7 @@ class RimOilRegionEntry : public caf::PdmObject
public:
RimOilRegionEntry();
~RimOilRegionEntry();
virtual caf::PdmFieldHandle* userDescriptionField();
virtual caf::PdmFieldHandle* objectToggleField();

View File

@ -201,5 +201,13 @@ void RimWellPathImport::defineObjectEditorAttribute(QString uiConfigName, caf::P
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPathImport::~RimWellPathImport()
{
regions.deleteAllChildObjects();
}

View File

@ -41,6 +41,7 @@ public:
public:
RimWellPathImport();
~RimWellPathImport();
caf::PdmField<bool> wellTypeSurvey;
caf::PdmField<bool> wellTypePlans;