From b5c07224a5d31dee8a3c40774ec7bb30c993dc1d Mon Sep 17 00:00:00 2001 From: "cbiesinger%web.de" Date: Sat, 3 Aug 2002 19:51:51 +0000 Subject: [PATCH] backout bug 157123, it caused crasher bug 160824 a=asa --- layout/xul/base/src/nsRepeatService.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/layout/xul/base/src/nsRepeatService.cpp b/layout/xul/base/src/nsRepeatService.cpp index ab09e2676cad..3c72a2a9af3b 100644 --- a/layout/xul/base/src/nsRepeatService.cpp +++ b/layout/xul/base/src/nsRepeatService.cpp @@ -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); } }