Crash on String concatenation
Posted: Mon Apr 09, 2018 21:59
I'm facing a strange bug the I don't manage to solve.
I just compiled dependencies and cegui for my SFML project with an openGLRenderer.
After initialiazing the renderer, I do this:
Unfortunately, the last line crash. It is normal as my previous paths are wrong (didn't set already, I'm on windows), but CEGUI should not crash on this.
Effectively, if path is wrong, the program passes here:
(DefaultResourceProvider.cpp; line 65)
But this "throw" crash instead of throw... With debugger, I saw that the bug come from here:
The result of the addition is a invalid String... But final_finename is a well-formed String...
In the operator + of String, that you can find here:
(String.cpp)
tmp is set to NULL, but str and c_str are corrects...
Is it a bug or bad configuration from myself?
Thank you in advance
Edit: I built CeGui without boost, I don't know if this is a mandatory library or not, I had real difficulties to simply build it as the documentation miss real important information about dependencies.
I just compiled dependencies and cegui for my SFML project with an openGLRenderer.
After initialiazing the renderer, I do this:
Code: Select all
CEGUI::DefaultResourceProvider *rp = static_cast<CEGUI::DefaultResourceProvider*>(CEGUI::System::getSingleton().getResourceProvider());
rp->setResourceGroupDirectory("schemes", "/usr/share/cegui-0/schemes/");
rp->setResourceGroupDirectory("imagesets", "/usr/share/cegui-0/imagesets/");
rp->setResourceGroupDirectory("fonts", "/usr/share/cegui-0/fonts/");
rp->setResourceGroupDirectory("layouts", "/usr/share/cegui-0/layouts/");
rp->setResourceGroupDirectory("looknfeels", "/usr/share/cegui-0/looknfeel");
rp->setResourceGroupDirectory("lua_scripts", "/usr/share/cegui-0/lua_scripts/");
CEGUI::ImageManager::setImagesetDefaultResourceGroup("imagesets");
CEGUI::Font::setDefaultResourceGroup("fonts");
CEGUI::Scheme::setDefaultResourceGroup("schemes");
CEGUI::WidgetLookManager::setDefaultResourceGroup("looknfeels");
CEGUI::WindowManager::setDefaultResourceGroup("layouts");
CEGUI::ScriptModule::setDefaultResourceGroup("lua_scripts");
CEGUI::SchemeManager::getSingleton().createFromFile("WindowsLook.scheme");
Unfortunately, the last line crash. It is normal as my previous paths are wrong (didn't set already, I'm on windows), but CEGUI should not crash on this.
Effectively, if path is wrong, the program passes here:
Code: Select all
if (file == 0)
CEGUI_THROW(FileIOException(final_filename + " does not exist"));
(DefaultResourceProvider.cpp; line 65)
But this "throw" crash instead of throw... With debugger, I saw that the bug come from here:
Code: Select all
final_filename + " does not exist"
The result of the addition is a invalid String... But final_finename is a well-formed String...
In the operator + of String, that you can find here:
Code: Select all
String operator+(const String& str, const char* c_str)
{
String tmp(str);
tmp.append(c_str);
return tmp;
}
(String.cpp)
tmp is set to NULL, but str and c_str are corrects...
Is it a bug or bad configuration from myself?
Thank you in advance
Edit: I built CeGui without boost, I don't know if this is a mandatory library or not, I had real difficulties to simply build it as the documentation miss real important information about dependencies.