Code: Select all
pCeguiRenderer = new CEGUI::OgreCEGUIRenderer( this->pRenderWin, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, this->pSceneMgr );
pCeguiSystem = new CEGUI::System( pCeguiRenderer );
This works fine and allocates pCeguiSystem a memory address of 0x00d50000.
Here is how I try to delete it in my class destructor:
Code: Select all
if ( pCeguiSystem )
delete pCeguiSystem;
if ( pCeguiRenderer )
delete pCeguiRenderer;
When the code reaches the delete pCeguiSystem; line, it gives the following error: Access violation reading location 0x014ba950.
Why is my program trying to access a different memory location? I have no idea what this address refers to - the pCeguiSystem address hasn't changed, and it's not the address of pCeguiRenderer either. Is this likely to be some sort of mistake with my C++ or could Ogre or something else be somehow interfering with the System object? Is there something else I should have deleted or created first? I'm really stumped!