Skip to content

Commit b324fdb

Browse files
committed
Close project if cancelling well path loading.
1 parent 9bea739 commit b324fdb

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

ApplicationLibCode/Application/RiaApplication.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,15 @@ bool RiaApplication::loadProject( const QString& projectFileName, ProjectLoadAct
548548
}
549549

550550
// Initialize well paths
551-
oilField->wellPathCollection->loadDataAndUpdate();
551+
if ( !oilField->wellPathCollection->loadDataAndUpdate() )
552+
{
553+
// Opening well path was cancelled or failed: close project.
554+
closeProject();
555+
m_project = std::make_unique<RimProject>();
556+
onProjectOpened();
557+
return true;
558+
}
559+
552560
oilField->ensembleWellLogsCollection->loadDataAndUpdate();
553561
oilField->vfpDataCollection->loadDataAndUpdate();
554562

ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ void RimWellPathCollection::fieldChangedByUi( const caf::PdmFieldHandle* changed
149149
//--------------------------------------------------------------------------------------------------
150150
/// Read files containing well path data, or create geometry based on the targets
151151
//--------------------------------------------------------------------------------------------------
152-
void RimWellPathCollection::loadDataAndUpdate()
152+
bool RimWellPathCollection::loadDataAndUpdate()
153153
{
154154
auto hasOsduData = []( const std::vector<RimWellPath*>& wellPaths ) -> bool
155155
{
@@ -200,7 +200,7 @@ void RimWellPathCollection::loadDataAndUpdate()
200200

201201
if ( progress.isCancelled() )
202202
{
203-
return;
203+
return false;
204204
}
205205

206206
progress.setProgressDescription( QString( "Reading well logs." ) );
@@ -230,6 +230,8 @@ void RimWellPathCollection::loadDataAndUpdate()
230230
rebuildWellPathNodes();
231231

232232
sortWellsByName();
233+
234+
return true;
233235
}
234236

235237
//--------------------------------------------------------------------------------------------------

ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class RimWellPathCollection : public caf::PdmObject
9797
caf::PdmField<bool> wellPathClip;
9898
caf::PdmField<int> wellPathClipZDistance;
9999

100-
void loadDataAndUpdate();
100+
bool loadDataAndUpdate();
101101
std::vector<RimWellPath*> addWellPaths( QStringList filePaths, QStringList* errorMessages );
102102
std::vector<RimWellPath*> allWellPaths() const;
103103
void removeWellPath( gsl::not_null<RimWellPath*> wellPath );

Fwk/AppFwk/cafUserInterface/cafProgressInfo.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,7 @@ void ProgressInfoStatic::finished()
695695
if ( dialog )
696696
{
697697
QObject::disconnect( dialog, &QProgressDialog::canceled, nullptr, nullptr );
698+
s_isButtonConnected = false;
698699

699700
dialog->reset();
700701
dialog->close();

0 commit comments

Comments
 (0)