27 Jul 2012 15:30
Program crashes after running for a few seconds/mins--issue with push_back()
Hi
I'm drawing lines between two markers in osgart. So whenever they are moved, the lines are updated each time.
For this I'm updating an
Code:
osg::ref_ptr<osg::Vec3Array> points
My program crashes after it is run for a several seconds/minutes. I found out that the following lines cause
the issue (commenting those can avoid it)
Code:
points->push_back(StartPoint);
points->push_back(EndPoint);
I assume it is due to a memory leak, eventhough I use points->clear() at the end.
Here's my code (please note that some lines have been omitted for clarity)
Code:
class CallBackClass: public osg::NodeCallback{
private:
osg::ref_ptr<osg::Vec3Array> points;
osg::ref_ptr<osg::Geometry> beam;
public:
CallBackClass::CallBackClass(){
points = new osg::Vec3Array;
beam = new osg::Geometry;
(Continue reading)
RSS Feed