Suggestion: System cleanup in constructor

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

kintaroe
Just popping in
Just popping in
Posts: 9
Joined: Wed Jan 26, 2011 11:45

Suggestion: System cleanup in constructor

Postby kintaroe » Fri Apr 08, 2011 16:31

Hello,

I noticed that the System class constructor may throw an exception, namely here:

Code: Select all

    // handle initialisation and setup of the XML parser
    setupXMLParser();

    // now XML is available, read the configuration file (if any)
    Config_xmlHandler config;
    if (!configFile.empty())
    {
        CEGUI_TRY
        {
            d_xmlParser->parseXMLFile(config, configFile,
                                      config.CEGUIConfigSchemaName,
                                      "");
        }
        CEGUI_CATCH(...)
        {
            // cleanup XML stuff
            d_xmlParser->cleanup();
            delete d_xmlParser;
            CEGUI_RETHROW;
        }
    }


I tried to catch this exception and bootstrap system with no xml file, but it fails with assertion and exceptions, probably because other singletons have been created and have not been destroyed before rethrowing the exception.

I would like to have your opinion about this.

Thanks in advance,
kintaroe

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

Re: Suggestion: System cleanup in constructor

Postby CrazyEddie » Tue Apr 19, 2011 08:14

...it fails with assertion and exceptions ... I would like to have your opinion about this.

Why don't you mention what the assertion and exception messages are? You really don't want my opinion - I get accused of being rude and impolite enough as it is ;)

It's possible to create the system without an xml config file. Did you mean without an XML parser? If so you would have to create a 'dummy' object and pass it in to the System::create call.

This has nothing to do with not cleaning up singletons; they do not exist at that point in the code.

CE.


Return to “Bug Reports, Suggestions, Feature Requests”

Who is online

Users browsing this forum: No registered users and 9 guests