From ec967d6b9fb18125db6c99f0796fbad1366fd018 Mon Sep 17 00:00:00 2001 From: Russell Taylor <taylorrj@ornl.gov> Date: Mon, 18 Jun 2012 17:03:33 -0400 Subject: [PATCH] Re #5462. Read-lock workspace for thread-safety. I've seen crashes at this point when running live data and the workspace updates. We need to keep an eye on performance here - this locks the workspace for every single data point (bin). If we see problems, we may have to refactor to do it more 'globally'. --- Code/Mantid/MantidPlot/src/Mantid/MantidMatrix.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Code/Mantid/MantidPlot/src/Mantid/MantidMatrix.cpp b/Code/Mantid/MantidPlot/src/Mantid/MantidMatrix.cpp index 14f636f85f2..9cffc56def9 100644 --- a/Code/Mantid/MantidPlot/src/Mantid/MantidMatrix.cpp +++ b/Code/Mantid/MantidPlot/src/Mantid/MantidMatrix.cpp @@ -9,6 +9,7 @@ #include "../pixmaps.h" #include "MantidAPI/TextAxis.h" +#include "MantidKernel/ReadLock.h" #include <QtGlobal> #include <QTextStream> @@ -1456,6 +1457,8 @@ void MantidMatrixModel::setup(const Mantid::API::MatrixWorkspace* ws, double MantidMatrixModel::data(int row, int col) const { + Mantid::Kernel::ReadLock _lock(*m_workspace); + double val; if (m_type == X) { -- GitLab