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

Bug 1749 - Timer record dialog: wxWidgets assert failure

The problem was that the end time was set to prohibit changes that brought it
before the start time.  However an update to start time could update the end time
before the end time updated its legal range.

The prohibition on going backwards in time is only for user interaction with
that control, so we now clear the legal range before update and then recreate it.

This change also fixes:
Bug 1978 - Windows: Timer Record - a "debugging check" dialog is shown to the user

In passing I also noticed that the controls were being updated every 50ms.
This is totally pointless as they only show the nearest second.  So I set the granularity
for control updates to 1s. (1000ms).
This commit is contained in:
James Crook 2018-09-17 15:31:55 +01:00
parent 7ea64d808b
commit 72f9fade8d

View File

@ -79,6 +79,11 @@ enum {
POST_TIMER_RECORD_SHUTDOWN
};
// The slow timer interval is used to update the start and end times, which only show
// time to the nearest second. So we only need an update once a second.
const int kSlowTimerInterval = 1000; // ms
// This timer interval is used in some busy-wait loops and is much shorter.
const int kTimerInterval = 50; // ms
static double wxDateTime_to_AudacityTime(wxDateTime& dateTime)
@ -177,7 +182,7 @@ TimerRecordDialog::TimerRecordDialog(wxWindow* parent, bool bAlreadySaved)
m_pTimeTextCtrl_Duration->SetFieldFocus(3);
m_timer.SetOwner(this, TIMER_ID);
m_timer.Start(kTimerInterval);
m_timer.Start(kSlowTimerInterval);
// Do we need to tidy up when the timer recording has been completed?
m_bProjectCleanupRequired = !(this->HaveFilesToRecover());
@ -1019,7 +1024,15 @@ void TimerRecordDialog::UpdateEnd()
{
//v Use remaining disk -> record time calcs from AudacityProject::OnTimer to set range?
m_DateTime_End = m_DateTime_Start + m_TimeSpan_Duration;
//wxLogDebug( "Time start %s end %s",
// m_DateTime_Start.FormatISOCombined(' '),
// m_DateTime_End.FormatISOCombined(' ') );
// Disable the range limitation (to fix Bug 1749 and 1978)
// Otherwise SetVallue asserts when going back in time.
m_pDatePickerCtrl_End->SetRange(wxInvalidDateTime, wxInvalidDateTime);
m_pDatePickerCtrl_End->SetValue(m_DateTime_End);
// Re-enable range limitation to constrain user input.
m_pDatePickerCtrl_End->SetRange(m_DateTime_Start, wxInvalidDateTime); // No backdating.
m_pDatePickerCtrl_End->Refresh();
m_pTimeTextCtrl_End->SetValue(wxDateTime_to_AudacityTime(m_DateTime_End));