Fix some memory leaks

This commit is contained in:
wmayer 2012-11-14 17:12:42 +01:00
parent d2ac422f68
commit 07a17af70a
2 changed files with 8 additions and 4 deletions

View File

@ -835,10 +835,10 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action)
SbVec3f z = vv.zVector();
const SbViewportRegion & vpr = SoViewportRegionElement::get(state);
SoGetMatrixAction * getmatrixaction = new SoGetMatrixAction(vpr);
getmatrixaction->apply(action);
SoGetMatrixAction getmatrixaction(vpr);
getmatrixaction.apply(action);
SbMatrix transform = getmatrixaction->getMatrix();
SbMatrix transform = getmatrixaction.getMatrix();
transform.multVecMatrix(surfNorm, surfNorm);
bool flip = surfNorm.dot(z) > FLT_EPSILON;

View File

@ -2631,6 +2631,9 @@ void ViewProviderSketch::rebuildConstraintsVisual(void)
// every constrained visual node gets its own material for preselection and selection
SoMaterial *Material = new SoMaterial;
// Not all kind of constraints need a material. So, increment its counter here and decrement
// it later to avoid a memory leak.
Material->ref();
Material->diffuseColor = ConstrDimColor;
// distinguish different constraint types to build up
@ -2718,9 +2721,10 @@ void ViewProviderSketch::rebuildConstraintsVisual(void)
break;
default:
edit->vConstrType.push_back(None);
}
}
edit->constrGroup->addChild(sep);
Material->unref();
}
}