Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 29, 2009, 10:27:10 PM (15 years ago)
Author:
rgrieder
Message:

Derived all singletons implemented in a usual manner from orxonox::Singleton<T>.
This resolves inconsistencies with the singletonPtr_s variable in case of exceptions (asserts were being triggered then).
And while at it replaced singletonRef_s with singletonPtr_s for it to be less misleading (as fabian has already pointed out).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/resource/src/core/Core.cc

    r3363 r3366  
    8383{
    8484    //! Static pointer to the singleton
    85     Core* Core::singletonRef_s  = 0;
     85    Core* Core::singletonPtr_s  = 0;
    8686
    8787    SetCommandLineArgument(mediaPath, "").information("Path to the media/data files");
     
    139139                .callback(this, &CoreConfiguration::debugLevelChanged);
    140140
    141             SetConfigValue(language_, Language::getLanguage().defaultLanguage_)
     141            SetConfigValue(language_, Language::getInstance().defaultLanguage_)
    142142                .description("The language of the ingame text")
    143143                .callback(this, &CoreConfiguration::languageChanged);
     
    179179        {
    180180            // Read the translation file after the language was configured
    181             Language::getLanguage().readTranslatedLanguageFile();
     181            Language::getInstance().readTranslatedLanguageFile();
    182182        }
    183183
     
    252252        // Cleanup guard for external console commands that don't belong to an Identifier
    253253        , consoleCommandDestroyer_(CommandExecutor::destroyExternalCommands)
     254        , configuration_(new CoreConfiguration()) // Don't yet create config values!
    254255        , bDevRun_(false)
    255256        , bGraphicsLoaded_(false)
    256         , configuration_(new CoreConfiguration()) // Don't yet create config values!
    257     {
    258         if (singletonRef_s != 0)
    259         {
    260             COUT(0) << "Error: The Core singleton cannot be recreated! Shutting down." << std::endl;
    261             abort();
    262         }
    263         Core::singletonRef_s = this;
    264 
     257    {
    265258        // Parse command line arguments first
    266259        CommandLine::parseCommandLine(cmdLine);
     
    328321    Core::~Core()
    329322    {
    330         // Don't assign singletonRef_s with NULL! Recreation is not supported
    331         // The is quite simply because of the pre-main code that uses heap allocation
    332         // And we correctly deallocate these resources in this destructor.
    333323    }
    334324
Note: See TracChangeset for help on using the changeset viewer.