Memory corruption

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

Therg
Just popping in
Just popping in
Posts: 2
Joined: Tue Mar 01, 2011 19:41

Memory corruption

Postby Therg » Tue Mar 01, 2011 19:58

Hello.
I have a problem with CEGUI-0.7.5: i'm creating an object by 'new' operator in window event mouseDown.
Callstack below:

Code: Select all

App.exe!GameWindow::mouseDown(const CEGUI::EventArgs & e)  Line 116   C++
App.exe!CEGUI::MemberFunctionSlot<GameWindow>::operator()(const CEGUI::EventArgs & args)  Line 55 + 0x14 bytes   C++

CEGUIBase_d.dll!CEGUI::SubscriberSlot::operator()(const CEGUI::EventArgs & args)  Line 82 + 0x17 bytes   C++
CEGUIBase_d.dll!CEGUI::Event::operator()(CEGUI::EventArgs & args)  Line 102 + 0x1e bytes   C++
CEGUIBase_d.dll!CEGUI::EventSet::fireEvent_impl(const CEGUI::String & name, CEGUI::EventArgs & args)  Line 229   C++
CEGUIBase_d.dll!CEGUI::EventSet::fireEvent(const CEGUI::String & name, CEGUI::EventArgs & args, const CEGUI::String & eventNamespace)  Line 171   C++
CEGUIBase_d.dll!CEGUI::Window::onMouseButtonDown(CEGUI::MouseEventArgs & e)  Line 2935 + 0x21 bytes   C++
CEGUIBase_d.dll!CEGUI::GUISheet::onMouseButtonDown(CEGUI::MouseEventArgs & e)  Line 72   C++
CEGUIBase_d.dll!CEGUI::System::injectMouseButtonDown(CEGUI::MouseButton button)  Line 786 + 0x16 bytes   C++

App.exe!PlayerInterface::mousePressed(const OIS::MouseEvent & arg, OIS::MouseButtonID id)  Line 80 + 0x29 bytes   C++

And after leaving this event (App.exe!GameWindow::mouseDown) object's data becomes incorrect. I have created data breakpoint on this object and it has fired.
Call stack:

Code: Select all

CEGUIBase_d.dll!std::_Iterator_base12::_Getcont()  Line 162 + 0x1d bytes   C++
 CEGUIBase_d.dll!std::_Tree_const_iterator<std::_Tree_val<std::_Tmap_traits<unsigned int,CEGUI::RefCounted<CEGUI::BoundSlot>,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,CEGUI::RefCounted<CEGUI::BoundSlot> > >,1> > >::operator++()  Line 254 + 0x8 bytes   C++
 CEGUIBase_d.dll!std::_Tree_iterator<std::_Tree_val<std::_Tmap_traits<unsigned int,CEGUI::RefCounted<CEGUI::BoundSlot>,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,CEGUI::RefCounted<CEGUI::BoundSlot> > >,1> > >::operator++()  Line 407   C++
 CEGUIBase_d.dll!CEGUI::Event::operator()(CEGUI::EventArgs & args)  Line 101 + 0x8 bytes   C++
 CEGUIBase_d.dll!CEGUI::EventSet::fireEvent_impl(const CEGUI::String & name, CEGUI::EventArgs & args)  Line 229   C++
 CEGUIBase_d.dll!CEGUI::EventSet::fireEvent(const CEGUI::String & name, CEGUI::EventArgs & args, const CEGUI::String & eventNamespace)  Line 171   C++
 CEGUIBase_d.dll!CEGUI::Window::onMouseButtonDown(CEGUI::MouseEventArgs & e)  Line 2935 + 0x21 bytes   C++
 CEGUIBase_d.dll!CEGUI::GUISheet::onMouseButtonDown(CEGUI::MouseEventArgs & e)  Line 72   C++
 CEGUIBase_d.dll!CEGUI::System::injectMouseButtonDown(CEGUI::MouseButton button)  Line 786 + 0x16 bytes   C++

App.exe!PlayerInterface::mousePressed(const OIS::MouseEvent & arg, OIS::MouseButtonID id)


May be i do something wrong or i must allocate memory in different way ?
Last edited by Therg on Thu Mar 03, 2011 15:34, edited 1 time in total.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Memory corruption

Postby CrazyEddie » Wed Mar 02, 2011 08:10

Allocating memory should be fine. In order for anyone to have any chance of spotting any errors, you will have to post the offending code.

Also, your callstack is worthless because it does not contain symbols for CEGUIBase_d.dll locations - please find out how to get the symbols working with that for any future issues ;)

CE.

Therg
Just popping in
Just popping in
Posts: 2
Joined: Tue Mar 01, 2011 19:41

Re: Memory corruption

Postby Therg » Thu Mar 03, 2011 16:46

I'm so sorry, it's my fault -( I have declared protected atrribute as

Code: Select all

Ogre::Vector3& mDestination;
so it references to stack varible, from which it was initialized in constructor.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Memory corruption

Postby CrazyEddie » Fri Mar 04, 2011 08:21

cool :hammer:


Return to “Help”

Who is online

Users browsing this forum: No registered users and 13 guests