Crash at shutdown.

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

JerryM
Just popping in
Just popping in
Posts: 9
Joined: Wed Oct 20, 2010 02:15

Crash at shutdown.

Postby JerryM » Mon Nov 15, 2010 16:31

Hello all,

I'm having a heap crash when I shutdown CEGUI. I'm using a custom rendering, parser, and codec.
15/11/2010 11:28:14 (Std) ---- Renderer module is: CEGUI Renderer ----
15/11/2010 11:28:14 (Std) ---- XML Parser module is: PugiXML Parser ----
15/11/2010 11:28:14 (Std) ---- Image Codec module is: PNG Image Codec ----
15/11/2010 11:28:14 (Std) ---- Scripting module is: None ----

CEGUIFalagardWRBase_d.dll!_CrtIsValidHeapPointer(const void * pUserData=0x157c08b0) Line 2103 C++
CEGUIFalagardWRBase_d.dll!_free_dbg_nolock(void * pUserData=0x157c08b0, int nBlockUse=1) Line 1317 + 0x9 bytes C++
CEGUIFalagardWRBase_d.dll!_free_dbg(void * pUserData=0x157c08b0, int nBlockUse=1) Line 1258 + 0xd bytes C++
CEGUIFalagardWRBase_d.dll!operator delete(void * pUserData=0x157c08b0) Line 54 + 0x10 bytes C++
CEGUIFalagardWRBase_d.dll!CEGUI::BoundSlot::`scalar deleting destructor'() + 0x46 bytes C++
CEGUIFalagardWRBase_d.dll!CEGUI::RefCounted<CEGUI::BoundSlot>::release() Line 186 + 0x2d bytes C++
CEGUIFalagardWRBase_d.dll!CEGUI::RefCounted<CEGUI::BoundSlot>::~RefCounted<CEGUI::BoundSlot>() Line 84 C++
CEGUIFalagardWRBase_d.dll!CEGUI::RefCounted<CEGUI::BoundSlot>::`scalar deleting destructor'() + 0x2b bytes C++
CEGUIFalagardWRBase_d.dll!std::_Destroy<CEGUI::RefCounted<CEGUI::BoundSlot> >(CEGUI::RefCounted<CEGUI::BoundSlot> * _Ptr=0x0ffc81e0) Line 60 C++
CEGUIFalagardWRBase_d.dll!std::allocator<CEGUI::RefCounted<CEGUI::BoundSlot> >::destroy(CEGUI::RefCounted<CEGUI::BoundSlot> * _Ptr=0x0ffc81e0) Line 160 + 0x9 bytes C++
CEGUIFalagardWRBase_d.dll!std::_Destroy_range<std::allocator<CEGUI::RefCounted<CEGUI::BoundSlot> > >(CEGUI::RefCounted<CEGUI::BoundSlot> * _First=0x0ffc81e0, CEGUI::RefCounted<CEGUI::BoundSlot> * _Last=0x0ffc8200, std::allocator<CEGUI::RefCounted<CEGUI::BoundSlot> > & _Al={...}, std::_Nonscalar_ptr_iterator_tag __formal={...}) Line 234 + 0xc bytes C++
CEGUIFalagardWRBase_d.dll!std::_Destroy_range<std::allocator<CEGUI::RefCounted<CEGUI::BoundSlot> > >(CEGUI::RefCounted<CEGUI::BoundSlot> * _First=0x0ffc81e0, CEGUI::RefCounted<CEGUI::BoundSlot> * _Last=0x0ffc8200, std::allocator<CEGUI::RefCounted<CEGUI::BoundSlot> > & _Al={...}) Line 225 + 0x2f bytes C++
CEGUIFalagardWRBase_d.dll!std::vector<CEGUI::RefCounted<CEGUI::BoundSlot>,std::allocator<CEGUI::RefCounted<CEGUI::BoundSlot> > >::_Destroy(CEGUI::RefCounted<CEGUI::BoundSlot> * _First=0x0ffc81e0, CEGUI::RefCounted<CEGUI::BoundSlot> * _Last=0x0ffc8200) Line 1124 + 0x14 bytes C++
CEGUIFalagardWRBase_d.dll!std::vector<CEGUI::RefCounted<CEGUI::BoundSlot>,std::allocator<CEGUI::RefCounted<CEGUI::BoundSlot> > >::erase(std::_Vector_const_iterator<CEGUI::RefCounted<CEGUI::BoundSlot>,std::allocator<CEGUI::RefCounted<CEGUI::BoundSlot> > > _First_arg={d_object=0x157c08b0 d_count=0x157c0938 }, std::_Vector_const_iterator<CEGUI::RefCounted<CEGUI::BoundSlot>,std::allocator<CEGUI::RefCounted<CEGUI::BoundSlot> > > _Last_arg={d_object=0xfdfdfdfd d_count=0xabababab }) Line 1054 C++
CEGUIFalagardWRBase_d.dll!std::vector<CEGUI::RefCounted<CEGUI::BoundSlot>,std::allocator<CEGUI::RefCounted<CEGUI::BoundSlot> > >::clear() Line 1065 + 0xaa bytes C++
CEGUIFalagardWRBase_d.dll!CEGUI::FalagardStaticText::onLookNFeelUnassigned() Line 469 C++
CEGUIBase_d.dll!CEGUI::Window::destroy() Line 1742 + 0x1d bytes C++
CEGUIBase_d.dll!CEGUI::WindowManager::destroyWindow(const CEGUI::String & window={...}) Line 225 + 0xf bytes C++
CEGUIBase_d.dll!CEGUI::WindowManager::destroyWindow(CEGUI::Window * window=0x157af640) Line 205 C++
CEGUIBase_d.dll!CEGUI::Window::cleanupChildren() Line 1319 C++
CEGUIBase_d.dll!CEGUI::Window::destroy() Line 1760 + 0x12 bytes C++
CEGUIBase_d.dll!CEGUI::WindowManager::destroyWindow(const CEGUI::String & window={...}) Line 225 + 0xf bytes C++
CEGUIBase_d.dll!CEGUI::WindowManager::destroyWindow(CEGUI::Window * window=0x157a9768) Line 205 C++
CEGUIBase_d.dll!CEGUI::Window::cleanupChildren() Line 1319 C++
CEGUIBase_d.dll!CEGUI::Window::destroy() Line 1760 + 0x12 bytes C++
CEGUIBase_d.dll!CEGUI::WindowManager::destroyWindow(const CEGUI::String & window={...}) Line 225 + 0xf bytes C++
CEGUIBase_d.dll!CEGUI::WindowManager::destroyAllWindows() Line 282 C++
CEGUIBase_d.dll!CEGUI::System::~System() Line 359 C++
CEGUIBase_d.dll!CEGUI::System::`vector deleting destructor'() + 0x6c bytes C++
CEGUIBase_d.dll!CEGUI::System::destroy() Line 1897 + 0x36 bytes C++


Both are debug versions, and they are both linked against the Multithreaded Debug (as opposed to Multithread Debug DLL). Any ideas?

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: Crash at shutdown.

Postby Kulik » Mon Nov 15, 2010 17:25

Could be a related to you using a custom renderer, codec and xml parser. Could you post more info about these? It is possible that you have a heap corruption somewhere else in the code. Or perhaps you are not using RefCounted as you should.

JerryM
Just popping in
Just popping in
Posts: 9
Joined: Wed Oct 20, 2010 02:15

Re: Crash at shutdown.

Postby JerryM » Mon Nov 15, 2010 18:57

That's possible. Could you elaborate on the proper use of RefCounted? I'm not using it at all. Furthermore, do you have any ideas on what could be the issue here with my custom plugins? After all, they are all modeled after the ones in the official source.

JerryM
Just popping in
Just popping in
Posts: 9
Joined: Wed Oct 20, 2010 02:15

Re: Crash at shutdown.

Postby JerryM » Mon Nov 15, 2010 19:29

Actually, there's no heap corruption when I use the compiled versions that come with the SDK. Perhaps my configuration is screwed up somehow.

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: Crash at shutdown.

Postby Kulik » Mon Nov 15, 2010 19:32

RefCounted is basically a "shared pointer". You can't for example delete what it's holding like this:

Code: Select all

delete refCounted.ptr();


And I have no idea what could be wrong with your renderer, codec or xml parser. I would have to see them to have any idea at all. There are countless of things that could go wrong there. Any reason why you would not contribute them?

From what you've supplied, I can't give advices, I can only guess and I am a bad psychic ;-)

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: Crash at shutdown.

Postby Jamarr » Mon Nov 15, 2010 19:49

Judging by the DLLs you are using, you appear to be building the non-static version of the CEGUI library. The non-static configuration links to the Multithread (Debug) DLL visual-c runtime library. You then state that you linked your own objects using the Multithreaded (Debug) visual-c runtime library. These are not compatible.

Did you not receive warnings like "<symbol> already defined in libcmtd.lib" or "<symbol> already defined in msvcrtd.lib"? And/or did you choose to ignore these warnings?

Your project, and every library thereof, should use the same MSVC runtime configuration or you will run into all kinds of unexplained / difficult to resolve issues. Most notably memory corruption issues as seems to be the case here.
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!

JerryM
Just popping in
Just popping in
Posts: 9
Joined: Wed Oct 20, 2010 02:15

Re: Crash at shutdown.

Postby JerryM » Mon Nov 15, 2010 19:53

Jamarr wrote:Judging by the DLLs you are using, you appear to be building the non-static version of the CEGUI library. The non-static configuration links to the Multithread (Debug) DLL visual-c runtime library. You then state that you linked your own objects using the Multithreaded (Debug) visual-c runtime library. These are not compatible.

Did you not receive warnings like "<symbol> already defined in libcmtd.lib" or "<symbol> already defined in msvcrtd.lib"? And/or did you choose to ignore these warnings?

Your project, and every library thereof, should use the same MSVC runtime configuration or you will run into all kinds of unexplained / difficult to resolve issues. Most notably memory corruption issues as seems to be the case here.

I've modified the configuration of CEGUI to link to the same runtime libraries, so that shouldn't be the issue. I was not receiving the warnings. As it stands, all of my projects show that they are all linking to the same runtime.


Kulik wrote:RefCounted is basically a "shared pointer". You can't for example delete what it's holding like this:

Code: Select all

delete refCounted.ptr();


And I have no idea what could be wrong with your renderer, codec or xml parser. I would have to see them to have any idea at all. There are countless of things that could go wrong there. Any reason why you would not contribute them?

From what you've supplied, I can't give advices, I can only guess and I am a bad psychic ;-)
The point was that this error is happening in a seemingly obscure place ;) I am never directly touching BoundSlot or deleting RefCounted pointers in my code. I'm using the stock code for where the callstack shows that this error is occurring (not to imply that the error is NOT within my code, though). And the code for the other modules are for an internal engine which would be of little use to the open source community ;) Not to mention the politics behind that. I realize that I am not giving out tons of information, but I am doing what I can. I appreciate all of the help so far.

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: Crash at shutdown.

Postby Kulik » Mon Nov 15, 2010 20:04

If you are on Linux I would advise you to run the code through valgrind and iron out memory errors. It seems it's a memory corruption and that could be happening anywhere it's just that it's manifesting in CEGUI shutdown.

The renderer is probably useless for us but the image codec and xml parser might not be :)

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: Crash at shutdown.

Postby Jamarr » Mon Nov 15, 2010 20:49

Well with that cleared up, as Kulik has already said, with the given information the best guess is some other code is writing over / corrupting some CEGUI memory which is manifesting itself during shutdown.
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!

JerryM
Just popping in
Just popping in
Posts: 9
Joined: Wed Oct 20, 2010 02:15

Re: Crash at shutdown.

Postby JerryM » Mon Nov 15, 2010 21:12

Any idea why it would work with the compiled versions in the SDK and not my own, aside from the runtime library? As I mentioned, it works fine with those, which leads me to believe it's not a memory issue in my own code. Also, would CEGUI be trying to call delete on one of my modules?

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: Crash at shutdown.

Postby Kulik » Mon Nov 15, 2010 21:53

Most likely is runtime/binary incompatiblity. Make sure you clean & rebuild everything, double check used runtimes.

JerryM
Just popping in
Just popping in
Posts: 9
Joined: Wed Oct 20, 2010 02:15

Re: Crash at shutdown.

Postby JerryM » Tue Nov 16, 2010 02:21

No dice there, unfortunately. I appreciate all of the help so far, despite my uninformative posts.

JerryM
Just popping in
Just popping in
Posts: 9
Joined: Wed Oct 20, 2010 02:15

Re: Crash at shutdown.

Postby JerryM » Wed Nov 17, 2010 13:30

It definitely appears to be an issue with my configuration when compiling CEGUI. I went as far as ripping out my xml parser and image codec (replacing them with the default ones) and commenting out all of my renderer code, and experience the same exact issue each time. Until I can sort out the configuration issues, I will just be using the precompiled libs and DLLs that ship with the SDK.

Thanks again for all of the ideas.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 23 guests