Handle settings sequencing

Avoids crash when window close ordering places 3d viewer after the
common settings are closed
This commit is contained in:
Seth Hillbrand 2022-05-25 16:56:54 -07:00
parent 5cd91a952f
commit c0a9a02591
2 changed files with 5 additions and 4 deletions

View File

@ -194,12 +194,13 @@ S3D_CACHE::S3D_CACHE()
S3D_CACHE::~S3D_CACHE()
{
COMMON_SETTINGS* commonSettings = Pgm().GetCommonSettings();
FlushCache();
// We'll delete ".3dc" cache files older than this many days
int clearCacheInterval = commonSettings->m_System.clear_3d_cache_interval;
int clearCacheInterval = 0;
if( Pgm().GetCommonSettings() )
Pgm().GetCommonSettings()->m_System.clear_3d_cache_interval;
// An interval of zero means the user doesn't want to ever clear the cache

View File

@ -559,7 +559,7 @@ void PGM_BASE::SaveCommonSettings()
COMMON_SETTINGS* PGM_BASE::GetCommonSettings() const
{
return m_settings_manager ? GetSettingsManager().GetCommonSettings() : nullptr;
return m_settings_manager ? m_settings_manager->GetCommonSettings() : nullptr;
}