|
I read this in the Delta3D docs and never
understood why. Delta3D mentions that: Destructors for subclasses of dtCore::Base
must have protected destructors. Otherwise use of RefPtrs will cause some
serious problems if the objects are allocated on the stack. So why is this? Any although this might have fixed some
problems, I am still having the same crashes on an Invalid Address specified to
RtlFreeHeap. When I comment out my 2 lines for my EventHandler creation, I
do not get these errors… From:
[EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On
Behalf Of Jolley, Thomas P Hi Jeff, You need to make sure any class derived
from osg::Referenced has a destructor that is _not_ public. You don't
want a default destructor. From: Don Burns
[mailto:[EMAIL PROTECTED] What is this: On 8/21/06, Jeff
Kershner <[EMAIL PROTECTED]>
wrote: 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/
