Handle settings sequencing

Avoids crash when window close ordering places 3d viewer after the
common settings are closed

(cherry picked from commit c0a9a02591)
This commit is contained in:
Seth Hillbrand 2022-05-25 16:56:54 -07:00
parent 6b2bb4d808
commit 592c2c6872
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

@ -384,7 +384,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;
}