diff --git a/src/osgPlugins/dw/ReaderWriterDW.cpp b/src/osgPlugins/dw/ReaderWriterDW.cpp index 578672cb8..5631fe9b0 100644 --- a/src/osgPlugins/dw/ReaderWriterDW.cpp +++ b/src/osgPlugins/dw/ReaderWriterDW.cpp @@ -407,7 +407,7 @@ public: GLfloat w[4], avertex **dataOut , _dwobj *dwob); void linkholes(const std::vector verts, const dwmaterial *themat, const _face *f1, const _face *f2, - const int ipr[2], const int idx[], const int nv) { + const int ipr[2], const int /*idx*/[], const int nv) { gsidx[nload]=f1->getidx(ipr[1]); // vertex position index gsidx[nload+1]=f1->getidx(ipr[0]); // vertex position index gsidx[nload+2]=f2->getidx(nv-ipr[0]-1); // vertex position index diff --git a/src/osgText/FTPolyGlyph.cpp b/src/osgText/FTPolyGlyph.cpp index 4ebdce81d..a78f10a95 100644 --- a/src/osgText/FTPolyGlyph.cpp +++ b/src/osgText/FTPolyGlyph.cpp @@ -33,10 +33,18 @@ void CALLBACK ftglEnd() } +// this static vector is to keep track of memory allocated by the combine +// callback below, so that it can be later deleted. This approach does +// assume that the Tesselate method is single threaded. +typedef std::vector CreatedVertices; +static CreatedVertices s_createdVertices; + void CALLBACK ftglCombine( GLdouble coords[3], void* /*vertex_data*/[4], GLfloat /*weight*/[4], void** outData) { double* vertex = osgNew double[3]; // FIXME MEM LEAK + s_createdVertices.push_back(vertex); + vertex[0] = coords[0]; vertex[1] = coords[1]; vertex[2] = coords[2]; @@ -130,6 +138,15 @@ void FTPolyGlyph::Tesselate() glEndList(); gluDeleteTess( tobj); + + // clean up the vertices create in the combine callback. + for(CreatedVertices::iterator itr=s_createdVertices.begin(); + itr!=s_createdVertices.end(); + ++itr) + { + osgDelete [] (*itr); + } + s_createdVertices.clear(); }