Fix some meory leaks in adaptive evaluator

- It used to create _computeContext twice.
- Ownership of refiner didn't set properly, because
  Initialize() forces evaluator to drop ownership.
  So now ownership sets after initialization from
  topology.
This commit is contained in:
Sergey Sharybin 2014-05-11 13:37:03 +02:00
parent b85324dbf9
commit f410190cde

View File

@ -80,13 +80,15 @@ OsdUtilAdaptiveEvaluator::Initialize(
// create and initialize a refiner, passing "true" for adaptive
// to indicate we wish for adaptive refinement rather than uniform
OsdUtilRefiner *refiner = new OsdUtilRefiner();
_ownsRefiner = true;
if (not refiner->Initialize(t, true, errorMessage)) {
delete refiner;
return false;
}
return Initialize(refiner, errorMessage);
bool result = Initialize(refiner, errorMessage);
_ownsRefiner = true;
return result;
}
bool
@ -114,10 +116,6 @@ OsdUtilAdaptiveEvaluator::Initialize(
return false;
}
_computeContext = OsdCpuComputeContext::Create(fmesh->GetSubdivisionTables(),
fmesh->GetVertexEditTables());
// Three elements (x/y/z) per refined point at every subdivision level
// defined by the farMesh. The coarse vertices seed the beginning of
// this buffer, and Refine populates the rest based on subdivision