Need to be able to cancel in-progress timers

RESOLVED FIXED in mozilla0.9.1

Status

Core Graveyard
Widget: Mac
P3
normal
RESOLVED FIXED
17 years ago
8 years ago

People

(Reporter: Simon Fraser, Assigned: Simon Fraser)

Tracking

Trunk
mozilla0.9.1
PowerPC
Mac System 8.5

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

17 years ago
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.
(Assignee)

Comment 1

17 years ago
Created attachment 29898 [details] [diff] [review]
Mac timers fix
(Assignee)

Comment 2

17 years ago
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.

Comment 3

17 years ago
looks like this one may be getting in by moz0.9
Priority: -- → P3
Target Milestone: --- → mozilla0.9

Comment 4

17 years ago
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.
(Assignee)

Comment 5

17 years ago
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.
(Assignee)

Comment 6

17 years ago
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.

Comment 8

17 years ago
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. 
(Assignee)

Comment 9

17 years ago
Boink.
Target Milestone: mozilla0.9 → mozilla0.9.1
looks good, r=pink
(Assignee)

Comment 11

17 years ago
scc/waterson: can I have an sr please?
Status: NEW → ASSIGNED

Comment 12

17 years ago
sr=waterson
(Assignee)

Comment 13

17 years ago
Thanks man. Just 1 second too late for my checkin comment!.
Checked in.
Status: ASSIGNED → RESOLVED
Last Resolved: 17 years ago
Resolution: --- → FIXED

Updated

13 years ago
Component: XP Miscellany → Widget: Mac

Updated

8 years ago
Component: Widget: Mac → Widget: Mac
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.