Hello Robert,
Thank you very much for your reply. I did remove the "_log << message;" line
and the problem goes away. When I get the crush, in which VStudio reports heap
corruption, I use the debugger to have a look at the corrupted memory block,
and it always points to some region where the notice strings are saved. In my
program I do not do anything fancy. It is an extremely simple case:
Code:
#include <cstdlib>
#include <osg/Group>
#include <osgViewer/Viewer>
#include "LogFileHandler.h"
// ---------------------------------------------------------------------
class MyUpdateCallback : public osg::NodeCallback
{
virtual void operator()( osg::Node* node, osg::NodeVisitor* nv) {
for(size_t i = 0; i < 1000; ++i) {
osg::notify( osg::NOTICE ) << "hello!";// << std::endl;
}
}
};
// ---------------------------------------------------------------------
int main( int agc, char** argv )
{
osg::setNotifyLevel(osg::DEBUG_FP);
osg::Group* root = new osg::Group();
LogFileHandler* fileHandler = new LogFileHandler("log.txt");
osg::setNotifyHandler(fileHandler);
root->setUpdateCallback(new MyUpdateCallback());
osgViewer::Viewer viewer;
viewer.setSceneData(root);
viewer.setUpViewInWindow(50,50,800,600);
viewer.run();
return EXIT_SUCCESS;
}
When I check the corrupted memory block sometimes I see something like
"hello!!hello!!hel«««««þîþîþ......þîþþîþþîþþîþ". Which looks corrupted to me.
If I add an std::endl at the end of my message in the above callback the
problem still appears but not very often. I have tried this program on 2
different PCs but both of them had windows7x64. I checked my lib and dll files,
I do not mix release and debug builds. The problem is very strange... I guess I
am missing something.
Thanks for your help!
Cheers,
George
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=44106#44106
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org