Commit 6a91019c authored by David E. DeMarle's avatar David E. DeMarle

use osp release not delete with osp volumes to prevent crashes

also, like delete, osprelease doesn't need if (nullptr) guard
parent 7e72778b
......@@ -152,9 +152,9 @@ void vtkOSPRayAMRVolumeMapperNode::Render(bool prepass)
}
else
{
if (this->OSPRayVolume && this->Cache->GetSize() == 0)
if (this->Cache->GetSize() == 0)
{
delete this->OSPRayVolume;
ospRelease(this->OSPRayVolume);
}
this->OSPRayVolume = ospNewVolume("amr_volume");
this->Cache->AddToCache(tstep, this->OSPRayVolume);
......
......@@ -445,18 +445,9 @@ vtkOSPRayRendererNode::~vtkOSPRayRendererNode()
delete[] this->Buffer;
delete[] this->ZBuffer;
delete[] this->ODepthBuffer;
if (this->OModel)
{
ospRelease((OSPModel)this->OModel);
}
if (this->ORenderer)
{
ospRelease((OSPRenderer)this->ORenderer);
}
if (this->OFrameBuffer)
{
ospRelease(this->OFrameBuffer);
}
ospRelease((OSPModel)this->OModel);
ospRelease((OSPRenderer)this->ORenderer);
ospRelease(this->OFrameBuffer);
this->AccumulateMatrix->Delete();
delete this->Internal;
}
......
......@@ -51,9 +51,9 @@ vtkOSPRayTetrahedraMapperNode::vtkOSPRayTetrahedraMapperNode()
vtkOSPRayTetrahedraMapperNode::~vtkOSPRayTetrahedraMapperNode()
{
ospRelease(this->TransferFunction);
if (this->OSPRayVolume && this->Cache->GetSize() == 0)
if (this->Cache->GetSize() == 0)
{
delete this->OSPRayVolume;
ospRelease(this->OSPRayVolume);
}
delete this->Cache;
}
......@@ -150,7 +150,7 @@ void vtkOSPRayTetrahedraMapperNode::Render(bool prepass)
{
if (this->OSPRayVolume && this->Cache->GetSize() == 0)
{
delete this->OSPRayVolume;
ospRelease(this->OSPRayVolume);
}
#if OSPRAY_VERSION_MAJOR == 1 && OSPRAY_VERSION_MINOR >= 5
this->OSPRayVolume = ospNewVolume("unstructured_volume");
......
......@@ -37,10 +37,7 @@ void vtkOSPRayVolumeCache::AddToCache(double tstep, osp::Volume *payload)
return;
}
osp::Volume *content = this->GetFromCache(tstep);
if (content)
{
delete content;
}
ospRelease(content);
this->Contents[tstep] = payload;
}
......@@ -60,7 +57,7 @@ void vtkOSPRayVolumeCache::Empty()
{
for (auto itr : this->Contents)
{
delete itr.second;
ospRelease(itr.second);
}
this->Contents.clear();
this->Size = 0;
......
......@@ -51,9 +51,9 @@ vtkOSPRayVolumeMapperNode::vtkOSPRayVolumeMapperNode()
vtkOSPRayVolumeMapperNode::~vtkOSPRayVolumeMapperNode()
{
ospRelease(this->TransferFunction);
if (this->OSPRayVolume && this->Cache->GetSize() == 0)
if (this->Cache->GetSize() == 0)
{
delete this->OSPRayVolume;
ospRelease(this->OSPRayVolume);
}
delete this->Cache;
}
......@@ -181,9 +181,9 @@ void vtkOSPRayVolumeMapperNode::Render(bool prepass)
return;
}
if (this->OSPRayVolume && this->Cache->GetSize() == 0)
if (this->Cache->GetSize() == 0)
{
delete this->OSPRayVolume;
ospRelease(this->OSPRayVolume);
}
this->OSPRayVolume = ospNewVolume("block_bricked_volume");
this->Cache->AddToCache(tstep, this->OSPRayVolume);
......
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