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/

Reply via email to