mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-07 15:49:42 +02:00
Mac: don't crash in Preferences when there is no project window...
... and you press Preview in Spectrogram preferences. And complete null checks on GetActiveProject calls in src/prefs. And in fact, don't even show the useless Preview button when there is no project.
This commit is contained in:
parent
92b857d551
commit
72f66b7096
@ -429,9 +429,12 @@ void SpectrumPrefs::Rollback()
|
||||
}
|
||||
|
||||
if (isOpenPage) {
|
||||
auto &tp = TrackPanel::Get ( *::GetActiveProject() );
|
||||
tp.UpdateVRulers();
|
||||
tp.Refresh(false);
|
||||
auto pProject = ::GetActiveProject();
|
||||
if ( pProject ) {
|
||||
auto &tp = TrackPanel::Get ( *pProject );
|
||||
tp.UpdateVRulers();
|
||||
tp.Refresh(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -477,9 +480,12 @@ void SpectrumPrefs::Preview()
|
||||
}
|
||||
|
||||
if (isOpenPage) {
|
||||
auto &tp = TrackPanel::Get( *::GetActiveProject() );
|
||||
tp.UpdateVRulers();
|
||||
tp.Refresh(false);
|
||||
auto pProject = ::GetActiveProject();
|
||||
if ( pProject ) {
|
||||
auto &tp = TrackPanel::Get( *pProject );
|
||||
tp.UpdateVRulers();
|
||||
tp.Refresh(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -500,7 +506,7 @@ bool SpectrumPrefs::Commit()
|
||||
|
||||
bool SpectrumPrefs::ShowsPreviewButton()
|
||||
{
|
||||
return true;
|
||||
return GetActiveProject() != nullptr;
|
||||
}
|
||||
|
||||
void SpectrumPrefs::OnControl(wxCommandEvent&)
|
||||
|
@ -191,9 +191,12 @@ bool WaveformPrefs::Commit()
|
||||
}
|
||||
|
||||
if (isOpenPage) {
|
||||
auto &tp = TrackPanel::Get( *::GetActiveProject() );
|
||||
tp.UpdateVRulers();
|
||||
tp.Refresh(false);
|
||||
auto pProject = ::GetActiveProject();
|
||||
if ( pProject ) {
|
||||
auto &tp = TrackPanel::Get( *pProject );
|
||||
tp.UpdateVRulers();
|
||||
tp.Refresh(false);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user