Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
Bug 1166932 - Part 1: Copy the editor observers array before iteratin…
Browse files Browse the repository at this point in the history
…g over it; r=roc
  • Loading branch information
ehsan committed May 23, 2015
1 parent ff106a4 commit 99f5d83
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions editor/libeditor/nsEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1807,10 +1807,12 @@ class EditorInputEventDispatcher : public nsRunnable
void
nsEditor::NotifyEditorObservers(NotificationForEditorObservers aNotification)
{
// Copy the observers since EditAction()s can modify mEditorObservers.
nsTArray<mozilla::dom::OwningNonNull<nsIEditorObserver>> observers(mEditorObservers);
switch (aNotification) {
case eNotifyEditorObserversOfEnd:
mIsInEditAction = false;
for (auto& observer : mEditorObservers) {
for (auto& observer : observers) {
observer->EditAction();
}

Expand All @@ -1822,13 +1824,13 @@ nsEditor::NotifyEditorObservers(NotificationForEditorObservers aNotification)
break;
case eNotifyEditorObserversOfBefore:
mIsInEditAction = true;
for (auto& observer : mEditorObservers) {
for (auto& observer : observers) {
observer->BeforeEditAction();
}
break;
case eNotifyEditorObserversOfCancel:
mIsInEditAction = false;
for (auto& observer : mEditorObservers) {
for (auto& observer : observers) {
observer->CancelEditAction();
}
break;
Expand Down

0 comments on commit 99f5d83

Please sign in to comment.