Bug2792: Audacity fails to launch...

... bug was introduced at f1de843
This commit is contained in:
Paul Licameli 2021-05-18 17:11:46 -04:00
parent b1f05e5747
commit bacf06944a
2 changed files with 13 additions and 6 deletions

View File

@ -120,10 +120,17 @@ public:
return mDefaultValue;
}
//! overload of Read returning a success flag
/*! The cache is unchanged if that is false */
//! overload of Read returning a boolean that is true if the value was previously defined */
bool Read( T *pVar ) const
{
return ReadWithDefault( pVar, GetDefault() );
}
//! overload of ReadWithDefault returning a boolean that is true if the value was previously defined */
bool ReadWithDefault( T *pVar, const T& defaultValue ) const
{
if ( pVar )
*pVar = defaultValue;
if ( pVar && this->mValid ) {
*pVar = this->mCurrentValue;
return true;

View File

@ -68,8 +68,10 @@ ProjectSettings::ProjectSettings(AudacityProject &project)
}
, mSnapTo( gPrefs->Read(wxT("/SnapTo"), SNAP_OFF) )
{
int intRate;
if ( !QualitySettings::DefaultSampleRate.Read( &intRate ) ) {
int intRate = 0;
bool wasDefined = QualitySettings::DefaultSampleRate.Read( &intRate );
mRate = intRate;
if ( !wasDefined ) {
// The default given above can vary with host/devices. So unless there is
// an entry for the default sample rate in audacity.cfg, Audacity can open
// with a rate which is different from the rate with which it closed.
@ -77,8 +79,6 @@ ProjectSettings::ProjectSettings(AudacityProject &project)
QualitySettings::DefaultSampleRate.Write( mRate );
gPrefs->Flush();
}
else
mRate = intRate;
gPrefs->Read(wxT("/GUI/SyncLockTracks"), &mIsSyncLocked, false);
bool multiToolActive = false;