backout bug 157123, it caused crasher bug 160824

a=asa
This commit is contained in:
cbiesinger%web.de 2002-08-03 19:51:51 +00:00
parent 75b005d166
commit b5c07224a5

View File

@ -46,7 +46,7 @@
#if defined(XP_MAC) || defined(XP_MACOSX)
#define INITAL_REPEAT_DELAY 250
#define REPEAT_DELAY 25
#define REPEAT_DELAY 10
#else
#define INITAL_REPEAT_DELAY 250
#define REPEAT_DELAY 50
@ -92,14 +92,14 @@ void nsRepeatService::Start(nsITimerCallback* aCallback)
mRepeatTimer = do_CreateInstance("@mozilla.org/timer;1", &rv);
if (NS_OK == rv) {
mRepeatTimer->Init(this, INITAL_REPEAT_DELAY, PR_TRUE, NS_TYPE_REPEATING_SLACK);
mFirstCall = PR_TRUE;
mRepeatTimer->Init(this, INITAL_REPEAT_DELAY);
}
}
void nsRepeatService::Stop()
{
//printf("Stopping repeat timer\n");
if (mRepeatTimer) {
mRepeatTimer->Cancel();
mRepeatTimer = nsnull;
@ -109,14 +109,19 @@ void nsRepeatService::Stop()
NS_IMETHODIMP_(void) nsRepeatService::Notify(nsITimer *timer)
{
// if the repeat delay is the initial one reset it.
if (mRepeatTimer) {
mRepeatTimer->Cancel();
}
// do callback
if (mCallback)
mCallback->Notify(timer);
// start timer again.
if (mFirstCall) {
mRepeatTimer->SetDelay(REPEAT_DELAY);
mFirstCall = PR_FALSE;
if (mRepeatTimer) {
mRepeatTimer = do_CreateInstance("@mozilla.org/timer;1");
mRepeatTimer->Init(this, REPEAT_DELAY);
}
}