Closed
Bug 1567461
Opened 6 years ago
Closed 6 years ago
Prevent ModuloBuffer copying, fix moving
Categories
(Core :: Gecko Profiler, defect, P1)
Core
Gecko Profiler
Tracking
()
RESOLVED
FIXED
mozilla70
| Tracking | Status | |
|---|---|---|
| firefox70 | --- | fixed |
People
(Reporter: mozbugz, Assigned: mozbugz)
References
Details
Attachments
(1 file)
ModuloBuffer may own the underlying byte buffer and may delete it as needed.
If copied or moved, both ModuloBuffer will try to free the resource.
- Copies should just be prevented (like UniquePtr).
- Moves should ensure that the moved-from ModuloBuffer won't delete the resource.
| Assignee | ||
Comment 1•6 years ago
|
||
Without declaring them, ModuloBuffer had its copy&move constructor&assignments
defaulted. This means it could have been copied, and then both objects would now
own the same resource and attempt to free it on destruction!
So now:
- Copy construction&assignment are now explicitly disallowed.
- Move assignment is disallowed, to keep some members
const. - Move construction is allowed (so a function can return a ModuloBuffer), and
ensures that the moved-from object won't free the resource anymore.
Bonus: mBuffer is now const -- because it can be(!)
So ModuloBuffer is like an unchanging resource, but it allows to be moved-from
as an xvalue that should not be used after the move.
| Assignee | ||
Updated•6 years ago
|
Assignee: nobody → gsquelart
Pushed by gsquelart@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/74908c04ec0e
Ensure ModuloBuffer can be properly move-constructed - r=gregtatum
Comment 3•6 years ago
|
||
| bugherder | ||
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70
You need to log in
before you can comment on or make changes to this bug.
Description
•