PVS: V773 A memory leak is possible
This commit is contained in:
@@ -101,21 +101,20 @@ ViewProviderColorBuilder::~ViewProviderColorBuilder()
|
||||
{
|
||||
}
|
||||
|
||||
void ViewProviderColorBuilder::buildNodes(const App::Property* prop, std::vector<SoNode*>&) const
|
||||
void ViewProviderColorBuilder::buildNodes(const App::Property* prop, std::vector<SoNode*>& node) const
|
||||
{
|
||||
const App::PropertyColorList* color = static_cast<const App::PropertyColorList*>(prop);
|
||||
const std::vector<App::Color>& val = color->getValues();
|
||||
unsigned long i=0;
|
||||
|
||||
SoMaterial* material = new SoMaterial();
|
||||
material->enableNotify(false);
|
||||
material->diffuseColor.deleteValues(0);
|
||||
material->diffuseColor.setNum(val.size());
|
||||
|
||||
SbColor* colors = material->diffuseColor.startEditing();
|
||||
for (std::vector<App::Color>::const_iterator it = val.begin(); it != val.end(); ++it) {
|
||||
material->diffuseColor.set1Value(i++, SbColor(it->r, it->g, it->b));
|
||||
colors[i].setValue(it->r, it->g, it->b);
|
||||
i++;
|
||||
}
|
||||
|
||||
material->enableNotify(true);
|
||||
material->touch();
|
||||
material->diffuseColor.finishEditing();
|
||||
node.push_back(material);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user