mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5106 Fix crash when importing multiple well paths with the same name
This commit is contained in:
parent
c5f21b75fa
commit
538e42f278
@ -316,7 +316,7 @@ bool RiaApplication::openFile( const QString& fileName )
|
||||
}
|
||||
else if ( fileType & RiaDefines::ANY_ECLIPSE_FILE )
|
||||
{
|
||||
loadingSucceded = RicImportGeneralDataFeature::openEclipseFilesFromFileNames( QStringList{fileName}, true );
|
||||
loadingSucceded = RicImportGeneralDataFeature::openEclipseFilesFromFileNames( QStringList{ fileName }, true );
|
||||
lastUsedDialogTag = RiaDefines::defaultDirectoryLabel( fileType );
|
||||
}
|
||||
|
||||
@ -849,8 +849,8 @@ bool RiaApplication::openOdbCaseFromFile( const QString& fileName, bool applyTim
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Add a list of well path file paths (JSON files) to the well path collection
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimFileWellPath*> RiaApplication::addWellPathsToModel( QList<QString> wellPathFilePaths,
|
||||
QStringList* errorMessages )
|
||||
std::vector<RimWellPath*> RiaApplication::addWellPathsToModel( QList<QString> wellPathFilePaths,
|
||||
QStringList* errorMessages )
|
||||
{
|
||||
CAF_ASSERT( errorMessages );
|
||||
|
||||
@ -867,7 +867,7 @@ std::vector<RimFileWellPath*> RiaApplication::addWellPathsToModel( QList<QString
|
||||
m_project->updateConnectedEditors();
|
||||
}
|
||||
|
||||
std::vector<RimFileWellPath*> wellPaths;
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
if ( oilField->wellPathCollection )
|
||||
{
|
||||
wellPaths = oilField->wellPathCollection->addWellPaths( wellPathFilePaths, errorMessages );
|
||||
|
@ -54,7 +54,7 @@ class RigEclipseCaseData;
|
||||
class RimCommandObject;
|
||||
class RimEclipseCase;
|
||||
class RimEclipseView;
|
||||
class RimFileWellPath;
|
||||
class RimWellPath;
|
||||
class RimGridView;
|
||||
class RimProject;
|
||||
class RimSummaryPlot;
|
||||
@ -144,8 +144,8 @@ public:
|
||||
|
||||
bool openOdbCaseFromFile( const QString& fileName, bool applyTimeStepFilter = false );
|
||||
|
||||
std::vector<RimFileWellPath*> addWellPathsToModel( QList<QString> wellPathFilePaths, QStringList* errorMessages );
|
||||
void addWellPathFormationsToModel( QList<QString> wellPathFilePaths );
|
||||
std::vector<RimWellPath*> addWellPathsToModel( QList<QString> wellPathFilePaths, QStringList* errorMessages );
|
||||
void addWellPathFormationsToModel( QList<QString> wellPathFilePaths );
|
||||
std::vector<RimWellLogFile*> addWellLogsToModel( const QList<QString>& wellLogFilePaths, QStringList* errorMessages );
|
||||
|
||||
QString scriptDirectories() const;
|
||||
|
@ -103,11 +103,11 @@ RicfCommandResponse RicImportWellPaths::execute()
|
||||
RicfCommandResponse response;
|
||||
if ( !wellPathFiles.empty() )
|
||||
{
|
||||
std::vector<RimFileWellPath*> importedWellPaths = importWellPaths( wellPathFiles, &warningMessages );
|
||||
std::vector<RimWellPath*> importedWellPaths = importWellPaths( wellPathFiles, &warningMessages );
|
||||
if ( !importedWellPaths.empty() )
|
||||
{
|
||||
RicImportWellPathsResult* wellPathsResult = new RicImportWellPathsResult;
|
||||
for ( RimFileWellPath* wellPath : importedWellPaths )
|
||||
for ( RimWellPath* wellPath : importedWellPaths )
|
||||
{
|
||||
wellPathsResult->wellPathNames.v().push_back( wellPath->name() );
|
||||
}
|
||||
@ -136,15 +136,15 @@ RicfCommandResponse RicImportWellPaths::execute()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimFileWellPath*> RicImportWellPaths::importWellPaths( const QStringList& wellPathFilePaths,
|
||||
QStringList* errorMessages )
|
||||
std::vector<RimWellPath*> RicImportWellPaths::importWellPaths( const QStringList& wellPathFilePaths,
|
||||
QStringList* errorMessages )
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
|
||||
// Remember the path to next time
|
||||
app->setLastUsedDialogDirectory( "WELLPATH_DIR", QFileInfo( wellPathFilePaths.last() ).absolutePath() );
|
||||
|
||||
std::vector<RimFileWellPath*> wellPaths = app->addWellPathsToModel( wellPathFilePaths, errorMessages );
|
||||
std::vector<RimWellPath*> wellPaths = app->addWellPathsToModel( wellPathFilePaths, errorMessages );
|
||||
|
||||
RimProject* project = app->project();
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimFileWellPath;
|
||||
class RimWellPath;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -43,9 +43,8 @@ public:
|
||||
RicfCommandResponse execute() override;
|
||||
|
||||
protected:
|
||||
static std::vector<RimFileWellPath*> importWellPaths( const QStringList& wellPathFilePaths,
|
||||
QStringList* errorMessages );
|
||||
static QStringList wellPathNameFilters();
|
||||
static std::vector<RimWellPath*> importWellPaths( const QStringList& wellPathFilePaths, QStringList* errorMessages );
|
||||
static QStringList wellPathNameFilters();
|
||||
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
|
@ -202,7 +202,7 @@ void RimWellPathCollection::loadDataAndUpdate()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimFileWellPath*> RimWellPathCollection::addWellPaths( QStringList filePaths, QStringList* errorMessages )
|
||||
std::vector<RimWellPath*> RimWellPathCollection::addWellPaths( QStringList filePaths, QStringList* errorMessages )
|
||||
{
|
||||
CAF_ASSERT( errorMessages );
|
||||
|
||||
@ -259,11 +259,12 @@ std::vector<RimFileWellPath*> RimWellPathCollection::addWellPaths( QStringList f
|
||||
}
|
||||
|
||||
readAndAddWellPaths( wellPathArray );
|
||||
CAF_ASSERT( wellPathArray.empty() );
|
||||
|
||||
scheduleRedrawAffectedViews();
|
||||
updateAllRequiredEditors();
|
||||
|
||||
return wellPathArray;
|
||||
return wellPaths.childObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -304,7 +305,7 @@ void RimWellPathCollection::readAndAddWellPaths( std::vector<RimFileWellPath*>&
|
||||
|
||||
progress.incrementProgress();
|
||||
}
|
||||
|
||||
wellPathArray.clear(); // This should not be used again. We may have deleted items
|
||||
this->sortWellsByName();
|
||||
}
|
||||
|
||||
|
@ -89,8 +89,8 @@ public:
|
||||
|
||||
caf::PdmChildArrayField<RimWellPath*> wellPaths;
|
||||
|
||||
void loadDataAndUpdate();
|
||||
std::vector<RimFileWellPath*> addWellPaths( QStringList filePaths, QStringList* errorMessages );
|
||||
void loadDataAndUpdate();
|
||||
std::vector<RimWellPath*> addWellPaths( QStringList filePaths, QStringList* errorMessages );
|
||||
|
||||
void removeWellPath( RimWellPath* wellPath );
|
||||
void deleteAllWellPaths();
|
||||
|
Loading…
Reference in New Issue
Block a user