7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-07 19:05:32 +00:00

Cache APP_SETTINGS lookups

These are essentially singletons
This commit is contained in:
Jon Evans 2021-03-16 20:46:58 -04:00
parent 045160d486
commit 5e6b02f2d3

View File

@ -85,7 +85,10 @@ public:
template<typename AppSettings>
AppSettings* GetAppSettings( bool aLoadNow = true )
{
AppSettings* ret = nullptr;
static AppSettings* ret = nullptr;
if( ret )
return ret;
auto it = std::find_if( m_settings.begin(), m_settings.end(),
[]( const std::unique_ptr<JSON_SETTINGS>& aSettings )