Closed Bug 74827 Opened 23 years ago Closed 23 years ago

Need to be able to cancel in-progress timers

Categories

(Core Graveyard :: Widget: Mac, defect, P3)

PowerPC
Mac System 8.5
defect

Tracking

(Not tracked)

RESOLVED FIXED
mozilla0.9.1

People

(Reporter: sfraser_bugs, Assigned: sfraser_bugs)

References

Details

Attachments

(1 file)

The mac timer code currently bails on cancelling a timer that is currently being 
fired. However, because it's possible to have repeating timers, this makes it 
impossible to cancel timers from their callbacks. Also, the other platforms 
implement this.
Attached patch Mac timers fixSplinter Review
dcone: please test the attached patch, and let me know if it works. I can't test, 
because no other places in the code seem to attempt to cancel repeating timers 
from the callback.
looks like this one may be getting in by moz0.9
Priority: -- → P3
Target Milestone: --- → mozilla0.9
I tried the timer.. and the code gets only called once, so this does not work 
correctly.  
If you want to debug.. the timer is in 

mozilla/content/base/src/nsDocumentViewer.  There is a timer in there.
Go to the Notify method, this is the entry point for the timer and gets called 
only once.  If you print example 0, there will be two pages.. the timer gets 
called for the first page, but never the second page.. 
the correct behavior would be that the notify should get called once for each of 
two pages and then stop.
dcone: Print doesn't work for me in either viewer or Mozilla, so I can't debug 
this. Can you please try to debug the Mac timer changes here.

You should hit the assertion at:
NS_ASSERTION(aTimer->GetType() == NS_TYPE_ONE_SHOT, "Cancelling repeating 
timer");

when you try to cancel the repeating timer (the assetion is just for debugging, 
it should be removed from the patch). This should set aTimer->mCanceledInCallback 
to true, which causes the timer to get cancelled when its callback is done.
Additional note: I saw a repeating timer get cancelled (from, I think, image 
code) and stuff seemed to work fine. Should I be able to debug the print stuff 
now?
saari has been pulling his hair out over something like this in the art decoder. 
it seems repeating timers can be cancelled just dandy on mac, but you can't 
restart them on win32. cc'ing him.
Printing uses the one shot timer now, a page starts for each timer, so debuggin 
the repeating timers there will not work. The printing should have used one shot 
timers since repeating timers could have been notified multiple times for a 
page.  I am not sure who uses multiple timers now.. but this issue should still 
be fixed and tested for consistency across platform, it can cause problems as I 
found out.
Also.. to restart the windows timers.. you have to create a new one.. not just 
restart. On the Mac.. you can just restart them. I did go thru this problem 
also. 
Boink.
Target Milestone: mozilla0.9 → mozilla0.9.1
looks good, r=pink
scc/waterson: can I have an sr please?
Status: NEW → ASSIGNED
sr=waterson
Thanks man. Just 1 second too late for my checkin comment!.
Checked in.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Component: XP Miscellany → Widget: Mac
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: