Skip to content

Commit

Permalink
Merge pull request #38138 from mantidproject/38136_alfview_crash
Browse files Browse the repository at this point in the history
Wait for result before removing observers in BatchAlgorithmRunner destructor
  • Loading branch information
cailafinn authored Oct 9, 2024
2 parents 78d8466 + 24ebade commit 14353e2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Fixed a crash on the :ref:`ALF View <ALFView-ref>` when closing the interface while it is loading data.
7 changes: 6 additions & 1 deletion qt/widgets/common/src/BatchAlgorithmRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ BatchAlgorithmRunner::BatchAlgorithmRunner(QObject *parent)
m_algorithmErrorObserver(*this, &BatchAlgorithmRunner::handleAlgorithmError),
m_executeAsync(this, &BatchAlgorithmRunner::executeBatchAsyncImpl) {}

BatchAlgorithmRunner::~BatchAlgorithmRunner() { removeAllObservers(); }
BatchAlgorithmRunner::~BatchAlgorithmRunner() {
Poco::ActiveResult<bool> result = m_executeAsync(Poco::Void());
result.wait();

removeAllObservers();
}

void BatchAlgorithmRunner::addAllObservers() {
std::lock_guard<std::recursive_mutex> lock(m_notificationMutex);
Expand Down

0 comments on commit 14353e2

Please sign in to comment.