Skip to content

Commit

Permalink
Refs #4554 added locks to Paraview renderers
Browse files Browse the repository at this point in the history
To prevent segfaults from algorithms running in the background
  • Loading branch information
Janik Zikovsky committed Feb 3, 2012
1 parent f1d981a commit bb5b66e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Code/Mantid/Vates/VatesAPI/src/vtkMDEWHexahedronFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
#include <vtkHexahedron.h>
#include <vtkPoints.h>
#include <vtkUnstructuredGrid.h>
#include "MantidKernel/ReadLock.h"

using namespace Mantid::API;
using namespace Mantid::MDEvents;
using namespace Mantid::Geometry;
using Mantid::Kernel::CPUTimer;
using Mantid::Kernel::ReadLock;

namespace Mantid
{
Expand Down Expand Up @@ -43,6 +45,8 @@ namespace Mantid
{
bool VERBOSE = true;
CPUTimer tim;
// Acquire a scoped read-only lock to the workspace (prevent segfault from algos modifying ws)
ReadLock lock(*ws);

// First we get all the boxes, up to the given depth; with or wo the slice function
std::vector<IMDBox<MDE,nd> *> boxes;
Expand Down
4 changes: 4 additions & 0 deletions Code/Mantid/Vates/VatesAPI/src/vtkSplatterPlotFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
#include <vtkPoints.h>
#include <vtkUnstructuredGrid.h>
#include "vtkSystemIncludes.h"
#include "MantidKernel/ReadLock.h"

using namespace Mantid::API;
using namespace Mantid::MDEvents;
using namespace Mantid::Geometry;
using Mantid::Kernel::CPUTimer;
using Mantid::Kernel::ReadLock;

namespace Mantid
{
Expand Down Expand Up @@ -44,6 +46,8 @@ namespace Mantid
{
bool VERBOSE = true;
CPUTimer tim;
// Acquire a scoped read-only lock to the workspace (prevent segfault from algos modifying ws)
ReadLock lock(*ws);

// Find out how many events to skip before making a point
size_t totalPoints = ws->getNPoints();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
#include <vtkRectilinearGrid.h>
#include <vtkStructuredGrid.h>
#include "MantidAPI/NullCoordTransform.h"
#include "MantidKernel/ReadLock.h"

using Mantid::API::IMDWorkspace;
using Mantid::Kernel::CPUTimer;
using namespace Mantid::MDEvents;
using Mantid::Kernel::ReadLock;

namespace Mantid
{
Expand Down Expand Up @@ -99,7 +101,9 @@ namespace VATES
*/
vtkDataSet* vtkThresholdingHexahedronFactory::create3Dor4D(size_t timestep, bool do4D) const
{

// Acquire a scoped read-only lock to the workspace (prevent segfault from algos modifying ws)
ReadLock lock(*m_workspace);

const int nBinsX = static_cast<int>( m_workspace->getXDimension()->getNBins() );
const int nBinsY = static_cast<int>( m_workspace->getYDimension()->getNBins() );
const int nBinsZ = static_cast<int>( m_workspace->getZDimension()->getNBins() );
Expand Down

0 comments on commit bb5b66e

Please sign in to comment.