diff options
author | Moonchild <moonchild@palemoon.org> | 2022-04-18 14:31:55 +0200 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2022-04-18 14:31:55 +0200 |
commit | c2b4aa8cf2374d6178be94199e6e9def21bad51a (patch) | |
tree | 2fee2a7e51d9ef91871e37673c7561fa70d7d165 /layout | |
parent | 129bb5568d3664cec5d6787eb55225f1561d73ad (diff) | |
download | uxp-c2b4aa8cf2374d6178be94199e6e9def21bad51a.tar.gz |
Issue #1860 - Follow-up: Make sure we don't add duplicate frames
Changing to vector makes manipulating display list items more risky.
This is to make sure we don't inadvertently end up with duplicates in
the list of display items avoiding double-free scenarios.
Diffstat (limited to 'layout')
-rw-r--r-- | layout/base/FrameLayerBuilder.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index aa49c74cee..ff4661e1c8 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -162,7 +162,12 @@ void FrameLayerBuilder::DisplayItemData::AddFrame(nsIFrame* aFrame) { MOZ_RELEASE_ASSERT(mLayer); - mFrameList.AppendElement(aFrame); + + // Make sure we don't add duplicate frames as we're storing these as vectors. + // See UXP Issue #1860 + if (!mFrameList.Contains(aFrame)) { + mFrameList.AppendElement(aFrame); + } nsTArray<DisplayItemData*>* array = aFrame->GetProperty(FrameLayerBuilder::LayerManagerDataProperty()); |