Build MyGUI with Ogre 1.4.9

urosidoki

23-06-2012 18:17:36

Hi guys.

I am in troubles by compiling mygui with and old ogre version.

For any reason it works perfectly in release but I have a crash in the delete overriden in ogre memory manager when I am running in debug.
Did anybody have that problem before?

On the other hand I have realized that mygui is using C++0x, does that affect to my pure C++ application in somehow?

Cheers and thanks in advance.

Altren

24-06-2012 16:15:41

MyGUI doesn't use C++0x.
What about debug crashes - could you show where exactly it crashes?

urosidoki

24-06-2012 17:21:57

Yeah, it crashes in all the samples.

I will show for instance the Demo_Picking sample, if I execute it in Release all works perfectly fine.

But if I execute the sample in Debug, it will crash on this line:

inline void operator delete(void *reportedAddress)
{
Ogre::MemoryManager::instance().op_del_sc( reportedAddress, gProcessID );
}

And this is the CallStack:
OgreMain_d.dll!019320a8()
[Frames below may be incorrect and/or missing, no symbols loaded for OgreMain_d.dll]
OgreMain_d.dll!019336cf()
> Demo_Picking.exe!operator delete(void * reportedAddress=0x082e41b8) Line 372 + 0x23 bytes C++
Demo_Picking.exe!std::allocator<MyGUI::Widget *>::deallocate(MyGUI::Widget * * _Ptr=0x082e41b8, unsigned int __formal=1) Line 141 + 0x9 bytes C++
Demo_Picking.exe!std::vector<MyGUI::Widget *,std::allocator<MyGUI::Widget *> >::_Tidy() Line 1098 C++
Demo_Picking.exe!std::vector<MyGUI::Widget *,std::allocator<MyGUI::Widget *> >::~vector<MyGUI::Widget *,std::allocator<MyGUI::Widget *> >() Line 547 C++
Demo_Picking.exe!demo::DemoKeeper::createScene() Line 34 + 0x7b bytes C++
Demo_Picking.exe!base::BaseManager::create() Line 142 + 0xf bytes C++
Demo_Picking.exe!startApp<demo::DemoKeeper>() Line 35 + 0x8 bytes C++
Demo_Picking.exe!WinMain(HINSTANCE__ * hInst=0x00400000, HINSTANCE__ * __formal=0x00000000, char * strCmdLine=0x00133184, int argc=1) Line 60 + 0x8 bytes C++
Demo_Picking.exe!__tmainCRTStartup() Line 589 + 0x35 bytes C
Demo_Picking.exe!WinMainCRTStartup() Line 414 C

Any idea?

Cheers!

Altren

25-06-2012 10:24:51

I'm not sure, but I guess you have next problem: MyGUIEngine is compiled with default new/delete, but demos and MyGUI platform is compiled with Ogre's overloaded new/delete. Whenever you create something in MyGUIEngine and then get it back and delete it is created with default new, but deleted with ogre's delete.
So you should either use Ogre's new/delete inside MyGUIEngine or disable that custom new/delete (recommended).

urosidoki

27-06-2012 15:58:19

I have checked that the application can continues, I guess that this function:

Ogre::MemoryManager::instance().op_del_sc( reportedAddress, gProcessID );

is triggering an assert internally or something, that is the only explanation.
The problem comes from a copy construction of a vector, in the MyGUI_LayoutManager.cpp class the Line 72 we have this function:

VectorWidgetPtr LayoutManager::loadLayout(const std::string& _file, const std::string& _prefix, Widget* _parent)
{
...
return result;
}

The returning of that is being copied on a std::vector<Widget*> structure and for any reason that is triggering the assert.
And there is an interesting issue, which is that the delete of the vector "result" is using the standard delete, but the copied vector returned in the function is using the Ogre delete.

Any idea about how avoid this problem?

Kind Regards

Altren

27-06-2012 20:40:12

you should either use Ogre's new/delete inside MyGUIEngine or disable that custom new/delete (recommended).For first you need to include Ogre's header into MyGUI_Precompiled.h.
For second solution you should look how to disable that custom new/delete (using some define or something, I don't remember).