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.