X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e40298d54ecd5b109222a7c60aa2ef084a304d69..3d640cfc403ebc5cd96c95f325057b709550c4d1:/src/mac/carbon/timer.cpp diff --git a/src/mac/carbon/timer.cpp b/src/mac/carbon/timer.cpp index 3d43a7ca27..fe935003ca 100644 --- a/src/mac/carbon/timer.cpp +++ b/src/mac/carbon/timer.cpp @@ -43,6 +43,10 @@ static pascal void MacTimerProc( TMTask * t ) wxMacAddEvent( tm->m_table , wxProcessTimer, 0 , (void*) tm->m_timer , TRUE ) ; } +// we need this array to track timers that are being deleted within the Notify procedure +// adding the timer before the Notify call and checking after whether it still is in there +// as the destructor would have removed it from the array + wxArrayPtrVoid gTimersInProcess ; static void wxProcessTimer( unsigned long event , void *data ) @@ -86,7 +90,9 @@ void wxTimer::Init() bool wxTimer::IsRunning() const { - return ( m_info->m_task.qType & kTMTaskActive ) ; + // as the qType may already indicate it is elapsed, but it + // was not handled internally yet + return ( m_info->m_task.tmAddr != NULL ) ; } wxTimer::~wxTimer() @@ -105,27 +111,21 @@ bool wxTimer::Start(int milliseconds,bool mode) { (void)wxTimerBase::Start(milliseconds, mode); - wxCHECK_MSG( m_milli > 0, FALSE, wxT("invalid value for timer timeour") ); + wxCHECK_MSG( m_milli > 0, FALSE, wxT("invalid value for timer timeout") ); wxCHECK_MSG( m_info->m_task.tmAddr == NULL , FALSE, wxT("attempting to restart a timer") ); - m_milli = milliseconds; -#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340) m_info->m_task.tmAddr = NewTimerUPP( MacTimerProc ) ; -#else - m_info->m_task.tmAddr = NewTimerProc( MacTimerProc ) ; -#endif m_info->m_task.tmWakeUp = 0 ; m_info->m_task.tmReserved = 0 ; m_info->m_task.qType = 0 ; m_info->m_timer = this ; InsXTime((QElemPtr) &m_info->m_task ) ; PrimeTime( (QElemPtr) &m_info->m_task , m_milli ) ; - return FALSE; + return TRUE; } void wxTimer::Stop() { - m_milli = 0 ; if ( m_info->m_task.tmAddr ) { RmvTime( (QElemPtr) &m_info->m_task ) ;