Page 1 of 1

Crash on String concatenation

Posted: Mon Apr 09, 2018 21:59
by kryx
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:

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.

Re: Crash on String concatenation

Posted: Tue Apr 10, 2018 05:39
by Ident
Which version of CEGUI?

Boost is only needed for CEED.

Re: Crash on String concatenation

Posted: Tue Apr 10, 2018 08:37
by kryx
I downloaded the 0.8.7 version from your download page 5 days ago by clicking on "Source code packaged a a .zip file"

Thank you for the information about boost, I'm happy to don't need to install it :)

Edit: I downloaded the dependencies the same time

Re: Crash on String concatenation

Posted: Tue Apr 10, 2018 16:57
by kryx
Ok, I'm stupid. The exception was catched by visual studio and I thought that it was a crash.

So in fact all is working as intended... Can you suppress that post to save my honor? :oops:

Re: Crash on String concatenation

Posted: Tue Apr 10, 2018 18:01
by Ident
No

Re: Crash on String concatenation

Posted: Tue Apr 10, 2018 21:40
by kryx
Nooooo,

I will rename, change country, change my faces, remove my fingerprints, create a sect and never speak to the rest of the world now....

Re: Crash on String concatenation

Posted: Wed Apr 11, 2018 05:16
by Ident
I will be able to buy this info about you from the Zuck