1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-02 17:09:26 +02:00

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; return mDefaultValue;
} }
//! overload of Read returning a success flag //! overload of Read returning a boolean that is true if the value was previously defined */
/*! The cache is unchanged if that is false */
bool Read( T *pVar ) const 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 ) { if ( pVar && this->mValid ) {
*pVar = this->mCurrentValue; *pVar = this->mCurrentValue;
return true; return true;

View File

@ -68,8 +68,10 @@ ProjectSettings::ProjectSettings(AudacityProject &project)
} }
, mSnapTo( gPrefs->Read(wxT("/SnapTo"), SNAP_OFF) ) , mSnapTo( gPrefs->Read(wxT("/SnapTo"), SNAP_OFF) )
{ {
int intRate; int intRate = 0;
if ( !QualitySettings::DefaultSampleRate.Read( &intRate ) ) { bool wasDefined = QualitySettings::DefaultSampleRate.Read( &intRate );
mRate = intRate;
if ( !wasDefined ) {
// The default given above can vary with host/devices. So unless there is // 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 // 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. // 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 ); QualitySettings::DefaultSampleRate.Write( mRate );
gPrefs->Flush(); gPrefs->Flush();
} }
else
mRate = intRate;
gPrefs->Read(wxT("/GUI/SyncLockTracks"), &mIsSyncLocked, false); gPrefs->Read(wxT("/GUI/SyncLockTracks"), &mIsSyncLocked, false);
bool multiToolActive = false; bool multiToolActive = false;