Closed
Bug 1402202
Opened 7 years ago
Closed 7 years ago
Make FrameProperties::DeleteAll reentrancy safe
Categories
(Core :: Layout, enhancement, P3)
Core
Layout
Tracking
()
RESOLVED
FIXED
mozilla58
People
(Reporter: mattwoodrow, Assigned: mattwoodrow)
References
Details
Attachments
(1 file, 1 obsolete file)
3.53 KB,
patch
|
MatsPalmgren_bugz
:
review+
|
Details | Diff | Splinter Review |
If you have properties that reference other properties, then we can end up trying to remove a frame property from within a property destructor and things fall apart.
This just makes sure we don't modify the array under us so that things still work.
Attachment #8911024 -
Flags: review?(mats)
Updated•7 years ago
|
status-firefox57:
--- → wontfix
Updated•7 years ago
|
Priority: -- → P3
Comment 1•7 years ago
|
||
(In reply to Matt Woodrow (:mattwoodrow) from comment #0)
> If you have properties that reference other properties, then we can end up
> trying to remove a frame property from within a property destructor and
> things fall apart.
I wonder if that kind of complexity is something we should try to avoid
though. Frame properties were only meant to be simple POD data, not
arbitrary graphs :-)
Could you describe which properties need this and what they are
used for please? Or is this just a safety measure in case something
went wrong?
Flags: needinfo?(matt.woodrow)
Assignee | ||
Comment 2•7 years ago
|
||
See bug 1404181 for the patch queue, sorry about the size :)
We have new frame properties to track the set of display items allocated for each frame, and also new properties to store/retain an AnimatedGeometryRoot/ActiveScrolledRoot for the frame (if necessary).
We also have a property (on used on display roots) for storing the retained display list builder.
Deletion of the display list builder also triggers the deletion of all display items and AGR/ASRs for that frame.
If we decide to tear down the frame tree, and call DeleteAll on the display root, it can remove the display list builder entry first, and then recurse into trying to remove the entry for a display item or AGR/ASR and corrupts the vector.
Flags: needinfo?(matt.woodrow)
Assignee | ||
Updated•7 years ago
|
Flags: needinfo?(mats)
Comment 3•7 years ago
|
||
Comment on attachment 8911024 [details] [diff] [review]
frame-props
This looks OK in principle, but we need to implement it differently.
The |mInDeleteAll| flag bloats nsIFrame by 64 bits, which I think
is unacceptable.
Could we do something like this instead:
void DeleteAll(const nsIFrame* aFrame) {
nsTArray<PropertyValue> toDelete;
toDelete.SwapElements(mProperties);
for (auto& prop : toDelete) {
prop.DestroyValueFor(aFrame);
}
MOZ_ASSERT(mProperties.IsEmpty(), "a property dtor added new properties");
}
The only requirement then is that your property dtors can't depend on
other properties to exist on the same frame, but I think that's
already an invariant since the order properties are deleted when
the frame is destroyed is undefined.
Flags: needinfo?(mats) → needinfo?(matt.woodrow)
Attachment #8911024 -
Flags: review?(mats) → review-
Assignee | ||
Comment 4•7 years ago
|
||
Good catch on the increase to nsIFrame, we definitely don't want that.
Now that the recursive calls to DeleteProperty don't actually delete the property instantly (but when we get to them in the DeleteAll call), we need to make sure we're holding a strong ref to the values.
Attachment #8911024 -
Attachment is obsolete: true
Flags: needinfo?(matt.woodrow)
Attachment #8921360 -
Flags: review?(mats)
Comment 5•7 years ago
|
||
Comment on attachment 8921360 [details] [diff] [review]
frame-properties
> ... we need to make sure we're holding a strong ref to the values.
OK, makes sense. Thanks.
Don't forget to add a commit message before landing...
Attachment #8921360 -
Flags: review?(mats) → review+
Pushed by mwoodrow@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/8763e22a77b2
Make FrameProperties::DeleteAll handle the case where deletion of a property triggers deletion of another. r=mats
Comment 7•7 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
You need to log in
before you can comment on or make changes to this bug.
Description
•