git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46324
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
virtual bool Start(int milliseconds = -1, bool oneShot = false);
virtual void Stop();
virtual bool Start(int milliseconds = -1, bool oneShot = false);
virtual void Stop();
+ // for wxTimerScheduler only: resets the internal flag indicating that the
+ // timer is running
+ void MarkStopped()
+ {
+ wxASSERT_MSG( m_isRunning, _T("stopping non-running timer?") );
+
+ m_isRunning = false;
+ }
+
private:
bool m_isRunning;
private:
bool m_isRunning;
-
- friend class wxTimerScheduler;
};
// ----------------------------------------------------------------------------
};
// ----------------------------------------------------------------------------
#include "wx/log.h"
#include "wx/apptrait.h"
#include "wx/platinfo.h"
#include "wx/log.h"
#include "wx/apptrait.h"
#include "wx/platinfo.h"
// without this pragma, the stupid compiler precompiles #defines below so that
// changing them doesn't "take place" later!
// without this pragma, the stupid compiler precompiles #defines below so that
// changing them doesn't "take place" later!
virtual void Notify()
{
wxPrintf(_T("%d"), m_num++);
virtual void Notify()
{
wxPrintf(_T("%d"), m_num++);
+ wxTimer timer1;
+ timer1.Start(100, true /* one shot */);
+ timer1.Stop();
+ timer1.Start(100, true /* one shot */);
+
MyTimer timer;
timer.Start(500);
MyTimer timer;
timer.Start(500);
wxUnixTimerImpl * const timer = s->m_timer;
if ( timer->IsOneShot() )
{
wxUnixTimerImpl * const timer = s->m_timer;
if ( timer->IsOneShot() )
{
+ // the timer needs to be stopped but don't call its Stop() from
+ // here as it would attempt to remove the timer from our list and
+ // we had already done it, so we just need to reset its state
+ timer->MarkStopped();
+
// don't need it any more
delete s;
}
// don't need it any more
delete s;
}