Closed Bug 1022113 Opened 10 years ago Closed 10 years ago

Today-pane: too many calls to the function "setCurrentEvent" when updating the attribute "current"

Categories

(Calendar :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: bv1578, Assigned: bv1578)

Details

Attachments

(1 file, 1 obsolete file)

Steps to reproduce:
- set a check point (with dump() or cal.ERROR()) inside the function setCurrentEvent()
http://mxr.mozilla.org/comm-central/source/calendar/base/content/agenda-listbox.js#1000
- create an event for today that is "current" (with a start time before now and an end time in few minutes);
- expand the "Today" section in the today-pane in order to see the event as "current" (light blue background), wait for the end time of the event and take a look to the output of the check point.


The function setCurrentEvent() should be called once to update the "current" attribute of the event and remove it from today, but actually it is called a lot of times consecutively. On my system the function is usually called tens or hundreds of times (using a "static" variable as counter instead of dump or cal.ERROR, I found up to 600 calls) depending on system's activity and on the presence of others events scheduled for today as well.
Attached patch patch - v1.patch (obsolete) — Splinter Review
When setCurrentEvent() is called for the first time, the variable msuntillend
http://mxr.mozilla.org/comm-central/source/calendar/base/content/agenda-listbox.js#1020
is 0 and keeps that value for every call that occurs in that second. That value is used as timeout for the timer that schedules the next call, therefore this triggers a loop that lasts for one second. Afterwards msuntillend becomes negative and the timer is set with the correct timeout depending on the next events scheduled for today (or not set at all).

Excluding the condition msuntillend == 0 prevents to schedule the timer for the current event, that actually should be considered as elapsed in the second when setCurrentEvent() is called, and allows to remove it from the today-pane.
As far as I can see, it doesn't cause any side effects even on particular cases.
Attachment #8436281 - Flags: review?(Mozilla)
Attachment #8436281 - Flags: review?(Mozilla) → review+
Patch v1 with data for checkin

r=philipp
Attachment #8436281 - Attachment is obsolete: true
Attachment #8446406 - Flags: review+
Keywords: checkin-needed
https://hg.mozilla.org/comm-central/rev/8b00b8ebfd0c
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → 3.5
You need to log in before you can comment on or make changes to this bug.