Closed Bug 302229 Opened 19 years ago Closed 12 years ago

Removing an observer inside NotifyObservers can be problematic

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: darin.moz, Unassigned)

Details

Removing an observer inside NotifyObservers can be problematic.

It turns out that it is okay to remove an observer while it is being notified. 
This is because the observer service notifies observers in reverse order. 
However, it seems that there could be a problem if a different observer were
removed during a NotifyObservers call.  I don't have an examples where this
happens in the wild, but I could imagine that some xpcom-shutdown observer might
shutdown some other modules that call RemoveObserver when shutdown.  That might
lead to a crash.

I'm filing this bug as unconfirmed because I haven't verified it with an actual
testcase yet.  This bug report is just based on code inspection.
Assignee: darin → nobody
We cache the observer list before enumerating, this is safe.
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.