Fix some memory leaks

This commit is contained in:
wmayer
2012-11-15 01:25:55 +01:00
parent ec1de40d99
commit 2b5efd45fe

View File

@@ -2631,9 +2631,6 @@ 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
@@ -2653,6 +2650,11 @@ void ViewProviderSketch::rebuildConstraintsVisual(void)
sep->addChild(text);
edit->constrGroup->addChild(anno);
edit->vConstrType.push_back((*it)->Type);
// nodes not needed
sep->ref();
sep->unref();
Material->ref();
Material->unref();
continue; // jump to next constraint
}
break;
@@ -2724,7 +2726,6 @@ void ViewProviderSketch::rebuildConstraintsVisual(void)
}
edit->constrGroup->addChild(sep);
Material->unref();
}
}