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

Fix crash at startup in Mac release build

This commit is contained in:
Paul Licameli 2016-06-03 08:17:10 -04:00
commit 0296015023

View File

@ -1964,8 +1964,6 @@ AdornedRulerPanel::AdornedRulerPanel(AudacityProject* parent,
for (auto &button : mButtons) for (auto &button : mButtons)
button = nullptr; button = nullptr;
ReCreateButtons();
SetLabel( _("Timeline") ); SetLabel( _("Timeline") );
SetName(GetLabel()); SetName(GetLabel());
SetBackgroundStyle(wxBG_STYLE_PAINT); SetBackgroundStyle(wxBG_STYLE_PAINT);
@ -2003,8 +2001,6 @@ AdornedRulerPanel::AdornedRulerPanel(AudacityProject* parent,
mPlayRegionDragsSelection = (gPrefs->Read(wxT("/QuickPlay/DragSelection"), 0L) == 1)? true : false; mPlayRegionDragsSelection = (gPrefs->Read(wxT("/QuickPlay/DragSelection"), 0L) == 1)? true : false;
mQuickPlayEnabled = !!gPrefs->Read(wxT("/QuickPlay/QuickPlayEnabled"), 1L); mQuickPlayEnabled = !!gPrefs->Read(wxT("/QuickPlay/QuickPlayEnabled"), 1L);
UpdatePrefs();
#if wxUSE_TOOLTIPS #if wxUSE_TOOLTIPS
wxToolTip::Enable(true); wxToolTip::Enable(true);
#endif #endif
@ -2192,7 +2188,8 @@ void AdornedRulerPanel::OnPaint(wxPaintEvent & WXUNUSED(evt))
mNeedButtonUpdate = false; mNeedButtonUpdate = false;
// Do this first time setting of button status texts // Do this first time setting of button status texts
// when we are sure the CommandManager is initialized. // when we are sure the CommandManager is initialized.
UpdateButtonStates(); ReCreateButtons();
UpdatePrefs();
} }
wxPaintDC dc(this); wxPaintDC dc(this);
@ -2795,7 +2792,7 @@ void AdornedRulerPanel::UpdateButtonStates()
common(pinButton, wxT("PinnedHead"), label); common(pinButton, wxT("PinnedHead"), label);
} }
const auto scrubber = &mProject->GetScrubber(); auto &scrubber = mProject->GetScrubber();
{ {
const auto scrubButton = static_cast<AButton*>(FindWindow(OnScrubID)); const auto scrubButton = static_cast<AButton*>(FindWindow(OnScrubID));
@ -2803,7 +2800,7 @@ void AdornedRulerPanel::UpdateButtonStates()
"Scrubbing" is variable-speed playback "Scrubbing" is variable-speed playback
*/ */
common(scrubButton, wxT("Scrub"), _("Scrub")); common(scrubButton, wxT("Scrub"), _("Scrub"));
if (scrubber && scrubber->Scrubs()) if (scrubber.Scrubs())
scrubButton->PushDown(); scrubButton->PushDown();
else else
scrubButton->PopUp(); scrubButton->PopUp();
@ -2815,14 +2812,13 @@ void AdornedRulerPanel::UpdateButtonStates()
"Seeking" is normal speed playback but with skips "Seeking" is normal speed playback but with skips
*/ */
common(seekButton, wxT("Seek"), _("Seek")); common(seekButton, wxT("Seek"), _("Seek"));
if (scrubber && scrubber->Seeks()) if (scrubber.Seeks())
seekButton->PushDown(); seekButton->PushDown();
else else
seekButton->PopUp(); seekButton->PopUp();
} }
if(scrubber && if(mShowScrubbing != (scrubber.Scrubs() || scrubber.Seeks()))
mShowScrubbing != (scrubber->Scrubs() || scrubber->Seeks()))
OnToggleScrubbing(); OnToggleScrubbing();
} }