| 2009 | } |
| 2010 | |
| 2011 | void Application::destruct() |
| 2012 | { |
| 2013 | // saving system parameter |
| 2014 | if (_pcSysParamMngr->IgnoreSave()) { |
| 2015 | Base::Console().warning("Discard system parameter\n"); |
| 2016 | } |
| 2017 | else { |
| 2018 | Base::Console().log("Saving system parameter...\n"); |
| 2019 | _pcSysParamMngr->SaveDocument(); |
| 2020 | Base::Console().log("Saving system parameter...done\n"); |
| 2021 | } |
| 2022 | // saving the User parameter |
| 2023 | if (_pcUserParamMngr->IgnoreSave()) { |
| 2024 | Base::Console().warning("Discard user parameter\n"); |
| 2025 | } |
| 2026 | else { |
| 2027 | Base::Console().log("Saving user parameter...\n"); |
| 2028 | _pcUserParamMngr->SaveDocument(); |
| 2029 | Base::Console().log("Saving user parameter...done\n"); |
| 2030 | } |
| 2031 | |
| 2032 | // now save all other parameter files |
| 2033 | auto& paramMgr = _pcSingleton->mpcPramManager; |
| 2034 | for (const auto &it : paramMgr) { |
| 2035 | if ((it.second != _pcSysParamMngr) && (it.second != _pcUserParamMngr)) { |
| 2036 | if (it.second->HasSerializer() && !it.second->IgnoreSave()) { |
| 2037 | Base::Console().log("Saving %s...\n", it.first.c_str()); |
| 2038 | it.second->SaveDocument(); |
| 2039 | Base::Console().log("Saving %s...done\n", it.first.c_str()); |
| 2040 | } |
| 2041 | } |
| 2042 | } |
| 2043 | |
| 2044 | paramMgr.clear(); |
| 2045 | _pcSysParamMngr = nullptr; |
| 2046 | _pcUserParamMngr = nullptr; |
| 2047 | |
| 2048 | #ifdef FC_DEBUG |
| 2049 | // Do this only in debug mode for memory leak checkers |
| 2050 | cleanupUnits(); |
| 2051 | #endif |
| 2052 | |
| 2053 | CleanupProcess::callCleanup(); |
| 2054 | |
| 2055 | // not initialized or double destruct! |
| 2056 | assert(_pcSingleton); |
| 2057 | delete _pcSingleton; |
| 2058 | |
| 2059 | // We must detach from console and delete the observer to save our file |
| 2060 | destructObserver(); |
| 2061 | |
| 2062 | Base::Interpreter().finalize(); |
| 2063 | |
| 2064 | Base::ScriptFactorySingleton::Destruct(); |
| 2065 | Base::InterpreterSingleton::Destruct(); |
| 2066 | Base::Type::destruct(); |
| 2067 | ParameterManager::Terminate(); |
| 2068 | SafeMode::Destruct(); |
nothing calls this directly
no test coverage detected