[Solved]Crash only in debug

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

Littorio
Just popping in
Just popping in
Posts: 5
Joined: Tue Jul 15, 2008 18:56
Location: Italy

[Solved]Crash only in debug

Postby Littorio » Tue Jul 15, 2008 21:35

I've build the samples in CEGUI in 0.6.1. In release mode they run correctly but in debug they crash. i've debugged some demo and they all crash in this line

Code: Select all

// Go to previous glyph, if we are going backward
            if (!forward)
                if (--s == d_cp_map.begin ())  //CRASH HERE
                    break;


line 317 - file ceguifreetypefont.cpp
Last edited by Littorio on Thu Jul 17, 2008 10:25, edited 1 time in total.

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

Postby CrazyEddie » Wed Jul 16, 2008 05:26

Hi, and welcome :)

While I take no pleasure in making a post such as this one, it's something that has to be done...

Please read this post: http://www.cegui.org.uk/phpBB2/viewtopic.php?t=3351. Especially the part entitled: Do not just say "It's crashed, what's wrong?"

There is no useful diagnostic content in your post. How do you expect anybody to know what is going on? Sure you post the line where the 'crash' occurs, but without context it is meaningless.

The kind of thing we need to know here is:
* What operating system
* What compiler (including SP or lack thereof for MSVC++ 2005 / 2008)
* Callstack or backtrace
* And most importantly: THE TEXT OF THE EXCEPTION / CRASH MESSAGE

Posts like yours, without the required information, are just a waste of everybody's time.

CE.

Littorio
Just popping in
Just popping in
Posts: 5
Joined: Tue Jul 15, 2008 18:56
Location: Italy

Postby Littorio » Wed Jul 16, 2008 09:45

Windows XP SP2
Visual Studio 2003 SP1

The error message is "the application has requested the runtime to terminate it in an unusual way."

Callstack

> msvcr71d.dll!_NMSG_WRITE(int rterrnum=10) Line 195 C
msvcr71d.dll!abort() Line 44 + 0x7 C
stlport_vc71_stldebug46.dll!_STL::__stl_debug_engine<bool>::_Terminate() Line 324 C++
stlport_vc71_stldebug46.dll!_STL::__stl_debug_engine<bool>::_Assert(const char * __expr=0x007f8c3c, const char * __f=0x007f5904, int __l=162) Line 308 C++
CEGUIBase_d.dll!_STL::_DBG_iter_base<_STL::__Rb_tree<unsigned int,_STL::pair<unsigned int const ,CEGUI::FontGlyph>,_STL::_Select1st<_STL::pair<unsigned int const ,CEGUI::FontGlyph> >,_STL::less<unsigned int>,_STL::allocator<_STL::pair<unsigned int const ,CEGUI::FontGlyph> > > >::__decrement() Line 162 + 0x30 C++
CEGUIBase_d.dll!_STL::_DBG_iter<_STL::__Rb_tree<unsigned int,_STL::pair<unsigned int const ,CEGUI::FontGlyph>,_STL::_Select1st<_STL::pair<unsigned int const ,CEGUI::FontGlyph> >,_STL::less<unsigned int>,_STL::allocator<_STL::pair<unsigned int const ,CEGUI::FontGlyph> > >,_STL::_Const_traits<_STL::pair<unsigned int const ,CEGUI::FontGlyph> > >::operator--() Line 268 C++
CEGUIBase_d.dll!CEGUI::FreeTypeFont::rasterize(unsigned int start_codepoint=0, unsigned int end_codepoint=255) Line 317 + 0x37 C++
CEGUIBase_d.dll!CEGUI::Font::getGlyphData(unsigned int codepoint=70) Line 150 + 0x21 C++
CEGUIBase_d.dll!CEGUI::Font::getTextExtent(const CEGUI::String & text={...}, float x_scale=1.0000000) Line 169 + 0x15 C++
CEGUIBase_d.dll!CEGUI::ListboxTextItem::getPixelSize() Line 100 + 0x14 C++
CEGUIBase_d.dll!CEGUI::Listbox::getTotalItemsHeight() Line 691 + 0x28 C++
CEGUIBase_d.dll!CEGUI::Listbox::configureScrollbars() Line 577 + 0x8 C++
CEGUIBase_d.dll!CEGUI::Listbox::onListContentsChanged(CEGUI::WindowEventArgs & e={...}) Line 780 C++
CEGUIBase_d.dll!CEGUI::ComboDropList::onListContentsChanged(CEGUI::WindowEventArgs & e={...}) Line 107 C++
CEGUIBase_d.dll!CEGUI::Listbox::addItem(CEGUI::ListboxItem * item=0x022cd1d8) Line 306 + 0x14 C++
CEGUIBase_d.dll!CEGUI::Combobox::addItem(CEGUI::ListboxItem * item=0x022cd1d8) Line 402 C++
Sample_Demo6_d.exe!Demo6Sample::createDemoWindows() Line 131 + 0xf C++
Sample_Demo6_d.exe!Demo6Sample::initialiseSample() Line 81 C++
CEGUISampleHelper_d.dll!CEGuiD3D9BaseApplication::execute(CEGuiSample * sampleApp=0x0012ff4c) Line 158 + 0xd C++
CEGUISampleHelper_d.dll!CEGuiSample::initialise() Line 241 + 0x19 C++
CEGUISampleHelper_d.dll!CEGuiSample::run() Line 122 + 0xd C++
Sample_Demo6_d.exe!main(int argc=1, char * * argv=0x013bea38) Line 44 + 0xb C++
Sample_Demo6_d.exe!mainCRTStartup() Line 398 + 0x11 C
kernel32.dll!7c816d4f()
ntdll.dll!7c925b4f()
kernel32.dll!7c8399f3()



last line of log


Assigning the window renderer 'Falagard/Button' to the window 'Demo6/ControlPanel/SelModeBox__auto_droplist____auto_vscrollbar____auto_decbtn__'
Assigning LookNFeel 'TaharezLook/ImageButton' to window 'Demo6/ControlPanel/SelModeBox__auto_droplist____auto_vscrollbar____auto_decbtn__'.
Window 'Demo6/ControlPanel/SelModeBox__auto_droplist____auto_vscrollbar____auto_thumb__' of type 'TaharezLook/VerticalScrollbarThumb' has been created.
Assigning the window renderer 'Falagard/Button' to the window 'Demo6/ControlPanel/SelModeBox__auto_droplist____auto_vscrollbar____auto_thumb__'
Assigning LookNFeel 'TaharezLook/VerticalScrollbarThumb' to window 'Demo6/ControlPanel/SelModeBox__auto_droplist____auto_vscrollbar____auto_thumb__'.
Window 'Demo6/ControlPanel/SelModeBox__auto_button__' of type 'TaharezLook/ImageButton' has been created.
Assigning the window renderer 'Falagard/Button' to the window 'Demo6/ControlPanel/SelModeBox__auto_button__'
Assigning LookNFeel 'TaharezLook/ImageButton' to window 'Demo6/ControlPanel/SelModeBox__auto_button__'.
Attempting to create Imageset 'Commonwealth-10_auto_glyph_images_ ' with texture only.

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

Postby CrazyEddie » Wed Jul 16, 2008 10:07

Hi,

Thanks for the extra information - it is very helpful ;)

I did forget to ask if you built CEGUI yourself, or if you're using a precompiled SDK. I'll try to cover all the bases here in any case.

I think the issue is in some way related to STLport, specifically, I think there is a mismatch with regards to defining the '_STLP_DEBUG' macro.

If you are using an SDK, be aware that none of them use STLport, and so that is likely the source of the issues. Since we do not provide an STLport based SDK, you will probably end up needing to rebuild everything from source.

If you're building the library yourself also, then you may have to edit all the projects and add the '_STLP_DEBUG' in the preprocessor definitions for everything in debug mode (if you know about premake scripts, you could probably get this to happen fairly automatically).

So, in summary, I think you need to ensure consistent use of the '_STLP_DEBUG' macro. This may involve rebuilding CEGUI if you're using the SDK.

HTH

CE.

Littorio
Just popping in
Just popping in
Posts: 5
Joined: Tue Jul 15, 2008 18:56
Location: Italy

Postby Littorio » Wed Jul 16, 2008 18:40

I'm using the source version.

I have added

Code: Select all

#ifdef _DEBUG
   #define _STLP_DEBUG 1
#endif

in CEGUIBase.h and rebuilt all but nothing changed

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

Postby CrazyEddie » Wed Jul 16, 2008 19:26

Hi,

I actually think this is a bug in CEGUI. I have to run some tests to confirm - if ti is a bug I'll try and get you a fix tomorrow :)

Sorry for the inconvenience.

CE.

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

Postby CrazyEddie » Wed Jul 16, 2008 20:02

I confirmed this as an issue in CEGUI (basically we were decrementing an iterator already at the start of the sequence). I'm still considering other options for a fix, although it's almost certain that it will end up being this (which I tested as working):

Code: Select all

Index: CEGUIFreeTypeFont.cpp
===================================================================
--- CEGUIFreeTypeFont.cpp   (revision 1811)
+++ CEGUIFreeTypeFont.cpp   (working copy)
@@ -314,7 +314,7 @@
                 }
             // Go to previous glyph, if we are going backward
             if (!forward)
-                if (--s == d_cp_map.begin ())
+                if ((s == d_cp_map.begin()) || (--s == d_cp_map.begin()))
                     break;
         }
 


Hope it works for you too ;)

CE.

Littorio
Just popping in
Just popping in
Posts: 5
Joined: Tue Jul 15, 2008 18:56
Location: Italy

Postby Littorio » Thu Jul 17, 2008 10:24

This solved the problem.
Why it was happening only to me? It is caused by stlport?
I'm using stlport 4.6.2

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

Postby CrazyEddie » Thu Jul 17, 2008 11:15

It's because STLport in debug mode does a lot more checks than for example the native MSVC++ stl implementations.

libstdc++ as used with gcc is able to perform the same type of checks via its debug mode, although this is not used by default. Enabling the debug mode here allowed me to reproduce and pinpoint the issue. In the future I will enable this in debug builds to ensure we do not miss any subsequent issues :)

Thanks for helping find a really obscure issue, and allowing me to learn a valuable lesson (enable the debug checks!).

CE.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 16 guests