Greetings, First post so please bear with me. Anyhow, after searching the forum I've not run across this particular problem. osgText seems to corrupt the heap when changing the text of an existing osgText::Text object (I'll just say Text object from here on). Before I submitted this as a bug I'd like to know if anybody has experienced this or if I'm using the Text class incorrectly. Here is what I'm doing.
I have a scene that is rendering large poly count objects, using the Viewer and it's default camera, running on one thread. I also have a communications class running on a separate thread and a few other threads running. Finally, I have a second camera that I'm using to display text in the bottom left corner as an overlay or HUD added as a child to the viewer. The text is simple and I keep it at four lines that update text and position only when the text itself changes. These Text objects are never deleted and I only change their text and location. Since my change text function can be called by other threads I have a mutex locker at the start of the function and one right before I call the viewer to update to avoid race conditions. Here is what is happening and what I did to correct the problem. After X frames the debugger notifies me there has been a heap corruption. The corruption always takes place in Text::drawTextWithBackdrop. The problem seems to be that while the Text::drawTextWithBackdrop function is running Text::computeGlyphRepresentation is called by an OSG created thread and clears the _textureGlyphQuadMap member object. Thus, when the the iterator in Text::drawTextWithBackdrop is incremented in the for loop the iterator now contains a pointer to garbage. To solve this I put a locker at the beginning of both functions so that they could not use the _textureGlyphQuadMap at the same time. This solved the problem for me. So, I would like to know if a) I'm using the Text object correctly or if there is something else I should be doing to make it thread safe for a text update and b) if I'm using the Text object correctly then is this a known bug and do I need to submit a bug report. thanks, soulsabr ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42863#42863 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org