Possible bug in TextComponent

If you found a bug in our library or on our website, please report it in this section. In this forum you can also make concrete suggestions or feature requests.

Moderators: CEGUI MVP, CEGUI Team

komarx6
Not too shy to talk
Not too shy to talk
Posts: 24
Joined: Fri Oct 31, 2014 16:53

Possible bug in TextComponent

Postby komarx6 » Mon Jul 04, 2016 13:20

Sorry if this is false alarm but I need to share this with you just in case this is serious.
I've been playing with CEGUI for quite some time, and learned a lot from it's code base, so my friend called be to try to debug his project.
Application has been crashing with these three function on top of stack:
RenderedString::getPixelSize
LeftAlignedRenderedString::getVerticalExtent
TextComponent::render_impl

I don't like debugger very much so I decided to understand code and to figure out what is going on.
This is what I got so far, so you tell me if I'm right or wrong.

Falagard_xmlHandler creates TextComponent object on heap, then this object is copied to vector in ImagerySection, and old one is deleted.
But, when we create TextComponent, it's constructor creates d_renderedString, and d_formattedRenderedString. The later one has pointer to d_renderedString. When we assign this TextComponent to another one, new d_formattedRenderedString will point to same d_renderedString of old TextComponent object, because it's RefCounted. And this old d_renderedString will be deleted later, so it will point to deleted d_renderedString.

After I changed this line in TextComponent copy contructor:

Code: Select all

d_formattedRenderedString(obj.d_formattedRenderedString),

to look like this:

Code: Select all

d_formattedRenderedString(CELINE_NEW_AO LeftAlignedRenderedString(d_renderedString)),

(and also, I changed assignment operator same way) it does not break any more.

He has CEGUI 0.8.4.

Sorry if this was my mistake, I just felt responsibility to report this.

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Possible bug in TextComponent

Postby Ident » Mon Jul 04, 2016 13:43

Please follow the guidelines for posting. We also need:
- cegui log
- entire callstack
- the affected part of your code (as much of it as possible)
CrazyEddie: "I don't like GUIs"

komarx6
Not too shy to talk
Not too shy to talk
Posts: 24
Joined: Fri Oct 31, 2014 16:53

Re: Possible bug in TextComponent

Postby komarx6 » Tue Jul 05, 2016 14:45

These are information you wanted. But you don't even have to read it. I've found out what was the problem. It was our mistake. Still there is bug in CEGUI, as I'll explain at the end. So you can skip this.

OK this is log:
03/07/2016 17:07:52 (Std) +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
03/07/2016 17:07:52 (Std) + Crazy Eddie's GUI System - Event log +
03/07/2016 17:07:52 (Std) + (http://www.CrazzyE.org.uk/) +
03/07/2016 17:07:52 (Std) +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

03/07/2016 17:07:52 (Std) CEGUI::Logger singleton created. (0x813fad38)
03/07/2016 17:07:52 (Std)
03/07/2016 17:07:52 (Std) ********************************************************************************
03/07/2016 17:07:52 (Std) * Important: *
03/07/2016 17:07:52 (Std) * To get support at the CEGUI forums, you must post _at least_ the section *
03/07/2016 17:07:52 (Std) * of this log file indicated below. Failure to do this will result in no *
03/07/2016 17:07:52 (Std) * support being given; please do not waste our time. *
03/07/2016 17:07:52 (Std) ********************************************************************************
03/07/2016 17:07:52 (Std) ********************************************************************************
03/07/2016 17:07:52 (Std) * -------- START OF ESSENTIAL SECTION TO BE POSTED ON THE FORUM -------- *
03/07/2016 17:07:52 (Std) ********************************************************************************
03/07/2016 17:07:52 (Std) ---- Version: 0.0.1 (Build: Apr 14 2016 Static Debug Microsoft Windows g++ 4.8.1 32 bit) ----
03/07/2016 17:07:52 (Std) ---- Renderer module is: CELINE::OpenGLRenderer - Official OpenGL based 2nd generation renderer module. TextureTarget support enabled via FBO extension. ----
03/07/2016 17:07:52 (Std) ---- XML Parser module is: CEGUI::TinyXMLParser - Official tinyXML based parser module for CEGUI ----
03/07/2016 17:07:52 (Std) ---- Image Codec module is: SILLYImageCodec - Official SILLY based image codec ----
03/07/2016 17:07:52 (Std) ********************************************************************************
03/07/2016 17:07:52 (Std) * -------- END OF ESSENTIAL SECTION TO BE POSTED ON THE FORUM -------- *
03/07/2016 17:07:52 (Std) ********************************************************************************


and this is stack:
CEGUI::RenderedString::getPixelSize
CEGUI::LeftAlignedRenderedString::getVerticalExtent
CEGUI::TextComponent::render_impl
CEGUI::Falagard::ComponentBase::render
CEGUI::ImagerySection::render
CEGUI::SectionSpecification::render
CEGUI::LayerSpecification::render
CEGUI::StateImagery::render
CEGUI::FalagardDefault::render
CEGUI::Window::bufferGeometry
CEGUI::Window::drawSelf
CEGUI::Window::render
CEGUI::Window::render
CEGUI::Window::render
CEGUI::Window::render
CEGUI::GUIContext::renderWindowHierarchyToSurfaces
CEGUI::GUIContext::drawWindowContentToTarget
CEGUI::GUIContext::drawSelf
CEGUI::System::renderGUI
render_gui
...

komarx6
Not too shy to talk
Not too shy to talk
Posts: 24
Joined: Fri Oct 31, 2014 16:53

Re: Possible bug in TextComponent

Postby komarx6 » Tue Jul 05, 2016 14:57

But this is explanation of what happened:
We were fetching HorizontalFormatting from window property, which was native and saved in custom WindowRenderer. Well, real bug was that this value was not initialized in constructor and had invalid value, out side of enum's scope. Later in

Code: Select all

TextComponent::setupStringFormatter

this enum was checked and nothin has changed since there was no default statement in switch and value was invalid.
So that was our problem.
Here we come to the thing that I figured out yesterday. Since nothing was executed in switch, d_formattedRenderedString had old value, and that value had pointer to d_renderedString of original TextComponent that was created and destroyed (as I've explained in my first post) by Flagard_XmlHandler, so that pointer was not longer valid. So I still think that this could also be considered bug in CEGUI. Or a sleeper bug cell that will start making problems at some point in future.

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Possible bug in TextComponent

Postby Ident » Tue Jul 05, 2016 19:37

komarx6 wrote:03/07/2016 17:07:52 (Std) +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
03/07/2016 17:07:52 (Std) + Crazy Eddie's GUI System - Event log +
03/07/2016 17:07:52 (Std) + (http://www.CrazzyE.org.uk/) +
03/07/2016 17:07:52 (Std) +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

03/07/2016 17:07:52 (Std) CEGUI::Logger singleton created. (0x813fad38)
03/07/2016 17:07:52 (Std)
03/07/2016 17:07:52 (Std) ********************************************************************************
03/07/2016 17:07:52 (Std) * Important: *
03/07/2016 17:07:52 (Std) * To get support at the CEGUI forums, you must post _at least_ the section *
03/07/2016 17:07:52 (Std) * of this log file indicated below. Failure to do this will result in no *
03/07/2016 17:07:52 (Std) * support being given; please do not waste our time. *
03/07/2016 17:07:52 (Std) ********************************************************************************
03/07/2016 17:07:52 (Std) ********************************************************************************
03/07/2016 17:07:52 (Std) * -------- START OF ESSENTIAL SECTION TO BE POSTED ON THE FORUM -------- *
03/07/2016 17:07:52 (Std) ********************************************************************************
03/07/2016 17:07:52 (Std) ---- Version: 0.0.1 (Build: Apr 14 2016 Static Debug Microsoft Windows g++ 4.8.1 32 bit) ----
03/07/2016 17:07:52 (Std) ---- Renderer module is: CELINE::OpenGLRenderer - Official OpenGL based 2nd generation renderer module. TextureTarget support enabled via FBO extension. ----
03/07/2016 17:07:52 (Std) ---- XML Parser module is: CEGUI::TinyXMLParser - Official tinyXML based parser module for CEGUI ----
03/07/2016 17:07:52 (Std) ---- Image Codec module is: SILLYImageCodec - Official SILLY based image codec ----
03/07/2016 17:07:52 (Std) ********************************************************************************
03/07/2016 17:07:52 (Std) * -------- END OF ESSENTIAL SECTION TO BE POSTED ON THE FORUM -------- *
03/07/2016 17:07:52 (Std) ********************************************************************************

What the heck is CELINE::OpenGLRenderer and why does it say "CrazzyE.org.uk" and version 0.0.1?

What I actually wanted to learn from the log is which version you use. Do you know which it actually is that you use?
CrazyEddie: "I don't like GUIs"

komarx6
Not too shy to talk
Not too shy to talk
Posts: 24
Joined: Fri Oct 31, 2014 16:53

Re: Possible bug in TextComponent

Postby komarx6 » Wed Jul 06, 2016 06:28

Well, about the renderer I don't know. But about year ago three of us were playing with CEGUI and making some changes, that might explain version (and probably renderer). We used version 0.8.4, and I check yesterday this code I'm talking about is the same in 0.8.7
It's subtle and might not make problems for a log time but when it does it will be hard to track.
Any way it was his fault, because he made his own WindowRenderer, which had not initialized all its data members properly.
But still, having object that holds invalid pointer, even that I know it will be overwritten later, is spooky for me. And from my experience it will make problems, eventually.

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: Possible bug in TextComponent

Postby YaronCT » Wed Jul 06, 2016 14:53

@komarx6: I agree that we must take care of an invalid value of horizontal formatting. I'll look at it. Thanx for reporting!


Return to “Bug Reports, Suggestions, Feature Requests”

Who is online

Users browsing this forum: No registered users and 5 guests