Commit a73d8f06 authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge Committed by Hossain Mahmud

Added processor lock to VolumeRenderer when changing the raycaster to avoid race conditions.

Fixed duplicate member in OptimizedRaycaster.

Conflicts:
	modules/vis/processors/volumerenderer.cpp
parent 5671b803
......@@ -51,6 +51,9 @@ namespace campvis {
}
void AbstractTransferFunction::deinit() {
s_intensityDomainChanged.disconnect_all();
s_changed.disconnect_all();
delete _texture;
_texture = 0;
}
......
......@@ -37,7 +37,6 @@ namespace campvis {
OptimizedRaycaster::OptimizedRaycaster(IVec2Property* viewportSizeProp)
: RaycastingProcessor(viewportSizeProp, "modules/vis/glsl/optimizedraycaster.frag", true)
, p_targetImageID("targetImageID", "Output Image", "", DataNameProperty::WRITE)
, p_enableShading("EnableShading", "Enable Shading", true)
, p_lightId("LightId", "Input Light Source", "lightsource", DataNameProperty::READ)
, p_enableShadowing("EnableShadowing", "Enable Hard Shadows (Expensive!)", false)
......@@ -51,7 +50,6 @@ namespace campvis {
addProperty(p_enableShading, INVALID_RESULT | INVALID_PROPERTIES | INVALID_SHADER);
addProperty(p_lightId);
addProperty(p_targetImageID);
addProperty(p_enableIntersectionRefinement, INVALID_RESULT | INVALID_SHADER);
addProperty(p_useEmptySpaceSkipping, INVALID_RESULT | INVALID_BBV);
......
......@@ -78,8 +78,6 @@ namespace campvis {
/// \see AbstractProcessor::deinit
virtual void deinit();
DataNameProperty p_targetImageID; ///< image ID for output image
BoolProperty p_enableShading; ///< Flag whether to enable shading
DataNameProperty p_lightId; ///< Name/ID for the LightSource to use
BoolProperty p_enableShadowing;
......
......@@ -111,9 +111,6 @@ namespace campvis {
p_camera.addSharedProperty(&_orientationOverlay.p_camera);
p_outputImage.addSharedProperty(&_orientationOverlay.p_targetImageId);
s_processorCanBeDeleted.connect(this, &VolumeRenderer::onProcessorCanBeDeleted);
}
VolumeRenderer::~VolumeRenderer() {
......@@ -210,6 +207,10 @@ namespace campvis {
_orientationOverlay.p_passThroughImageId.setValue(p_outputImage.getValue() + ".raycasted");
}
if (prop == &p_raycastingProcSelector) {
// lock this processor while we exchange the ray caster to make sure nobody
// will call process() in between.
AbstractProcessor::ScopedLock lockGuard(this);
RaycastingProcessor *currentRaycaster = _raycaster;
// Change to previous raycaster if "Select Processor" is selected
if (p_raycastingProcSelector.getOptionId() == p_raycastingProcSelector.getOptions()[0]._id) {
......@@ -258,9 +259,7 @@ namespace campvis {
currentRaycaster->deinit();
invalidate(PG_INVALID | EEP_INVALID | RAYCASTER_INVALID | AbstractProcessor::INVALID_RESULT);
// queue the deletion of currentRaycaster as signal, to ensure that the deletion does
// not happen before all previously emitted signals have been handled.
s_processorCanBeDeleted.queueSignal(currentRaycaster);
delete currentRaycaster;
}
VisualizationProcessor::onPropertyChanged(prop);
......@@ -282,9 +281,5 @@ namespace campvis {
return _raycaster;
}
void VolumeRenderer::onProcessorCanBeDeleted(AbstractProcessor* processor) {
delete processor;
}
}
......@@ -135,20 +135,6 @@ namespace campvis {
OrientationOverlay _orientationOverlay;
static const std::string loggerCat_;
private:
/// Signal emitted when the processor in the signal's argument should be deleted
/// We perform this deletion through signals to ensure that all previouosly emitted signals
/// have been handled before the processor is deleted.
sigslot::signal1<AbstractProcessor*> s_processorCanBeDeleted;
/**
* Callback method for s_processorCanBeDeleted signal, deletes \a processor.
* We perform this deletion through signals to ensure that all previouosly emitted signals
* have been handled before the processor is deleted.
* \param processor Processor to delete.
*/
void onProcessorCanBeDeleted(AbstractProcessor* processor);
};
// Instantiate template to register the pipelines.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment