// Fetches a context by index. Context* GetContext(int index) { ContextMap::iterator i = contexts.begin(); int count = 0; if (index >= GetNumContexts()) index = GetNumContexts() - 1; while (count < index) { ++i; ++count; } if (i == contexts.end()) return NULL; return (*i).second; }
void Shutdown() { // Notify all plugins we're being shutdown. PluginRegistry::Instance()->NotifyShutdown(); // Release all remaining contexts. for (ContextMap::iterator itr = contexts.begin(); itr != contexts.end(); ++itr) Core::Log::Message(Log::LT_WARNING, "Context '%s' still active on shutdown.", (*itr).first.CString()); contexts.clear(); TemplateCache::Shutdown(); StyleSheetFactory::Shutdown(); StyleSheetSpecification::Shutdown(); FontDatabase::Shutdown(); TextureDatabase::Shutdown(); Factory::Instance()->Shutdown(); Factory::DestroyInstance(); Log::Shutdown(); PluginRegistry::DestroyInstance(); PropertyParserColour::DestroyInstance(); PropCounterSingleton::DestroyInstance(); initialised = false; if (render_interface != NULL) render_interface->RemoveReference(); if (file_interface != NULL) file_interface->RemoveReference(); if (system_interface != NULL) system_interface->RemoveReference(); render_interface = NULL; file_interface = NULL; system_interface = NULL; }