Closed
Bug 1152951
Opened 9 years ago
Closed 9 years ago
Explicitly delete copy-constructor & reassignment operator on flexbox stack-allocated helper-structs
Categories
(Core :: Layout, defect)
Core
Layout
Tracking
()
RESOLVED
FIXED
mozilla40
Tracking | Status | |
---|---|---|
firefox40 | --- | fixed |
People
(Reporter: dholbert, Assigned: dholbert)
References
Details
Attachments
(1 file)
2.38 KB,
patch
|
MatsPalmgren_bugz
:
review+
|
Details | Diff | Splinter Review |
Flexbox code instantiates some helper-objects on the stack to manage state, and passes around references to them. These objects should never be copied. Any copying would almost certainly be a bug (because state updates on the copy would be lost & not make it back to the original). So, we should delete the automatically-generated copy-constructor on these objects, to catch any such accidental-copying bugs at compile time. (And the reassignment operator, for good measure.)
Assignee | ||
Comment 1•9 years ago
|
||
Here's the (trivial) fix. A few notes: (1) PositionTracker previously had a halfhearted attempt to prevent copying, by making its copy constructor private. The "= delete" version that I'm replacing it with is strictly better. (2) The PositionTracker subclasses don't need this treatment -- they get these functions implicitly-deleted, via deriving from PositionTracker. (The child class's default copy-constructor / reassignment operator makes use of to the parent class's function; so given that the parent class has its functions deleted, the child class does too.) I verified this locally by trying to copy/reassign instances of these child classes, and I got a compile error. (good) (3) The "=delete" syntax is supported by on all our supported compilers, as of bug 1118486. (and this is documented at https://developer.mozilla.org/en-US/docs/Using_CXX_in_Mozilla_code as well)
Attachment #8590478 -
Flags: review?(mats)
Comment 2•9 years ago
|
||
Comment on attachment 8590478 [details] [diff] [review] fix v1 r=mats
Attachment #8590478 -
Flags: review?(mats) → review+
Assignee | ||
Comment 3•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/f3466cb572cb
Flags: in-testsuite-
Comment 4•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/f3466cb572cb
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
You need to log in
before you can comment on or make changes to this bug.
Description
•