|
Nothing is dynamically allocated in my
test app and so I am not freeing or deleting anything. From:
[EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On
Behalf Of Don Burns Are you freeing something
that was already being managed by a ref_ptr? On 8/21/06, Jeff
Kershner <[EMAIL PROTECTED]>
wrote: Thanks for the reply: So now I declared my derived event handler class like this: osg::ref_ptr<osgGA::GUIEventHandler> eh(new
EventHandler()); m_Viewer.getEventHandlerList().push_front(eh); But I am getting a crash in the msvcr71d.dll in free.c.
I believe the error I am getting is this: `scalar deleting destructor'() + 0x42 `scalar deleting destructor'() + 0x5b So this is either MSVC++ 7.1 telling me that it is breaking
on what it thinks to be a memory leak, or it is actually trying to free
something that has already been freed. Since this crash only happens when
I run with the debugger, I am leaning towards the first… Any ideas? From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]
On Behalf Of Don Burns Hi Jeff, On
8/16/06, Jeff Kershner <[EMAIL PROTECTED]>
wrote: I have an event handler class like this: class EventHandler : public osgGA::GUIEventHandler { public:
virtual bool handle(const osgGA::GUIEventAdapter& ea,
osgGA::GUIActionAdapter& aa); }; The handle function just calls the base class' handle
function… This is how it is implemented: EventHandler* pEventHandler = new EventHandler(); m_Viewer.getEventHandlerList().push_front(pEventHandler); When my application exits, I get a memory leak that is caused
by this EventHandler. Do I need to delete this EventHandler pointer? It feels weird to delete a pointer that I am handing to
another system… Finally, as a side note, does the EventHandler class that I
create need to have a virtual destructor explicitly written? Thanks, /jk
|
_______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
