If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Explicitly delete copy-constructor & reassignment operator on flexbox stack-allocated helper-structs

RESOLVED FIXED in Firefox 40

Status

()

Core
Layout
--
trivial
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: dholbert, Assigned: dholbert)

Tracking

Trunk
mozilla40
Points:
---
Bug Flags:
in-testsuite -

Firefox Tracking Flags

(firefox40 fixed)

Details

Attachments

(1 attachment)

(Assignee)

Description

3 years ago
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

3 years ago
Created attachment 8590478 [details] [diff] [review]
fix v1

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)
(Assignee)

Updated

3 years ago
Blocks: 1152913
Comment on attachment 8590478 [details] [diff] [review]
fix v1

r=mats
Attachment #8590478 - Flags: review?(mats) → review+
(Assignee)

Comment 3

3 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/f3466cb572cb
Flags: in-testsuite-
https://hg.mozilla.org/mozilla-central/rev/f3466cb572cb
Status: NEW → RESOLVED
Last Resolved: 3 years ago
status-firefox40: affected → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
You need to log in before you can comment on or make changes to this bug.