Closed
Bug 911806
Opened 11 years ago
Closed 11 years ago
CompileError should implement operator=
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
mozilla26
People
(Reporter: billm, Assigned: Benjamin)
Details
Attachments
(1 file)
1.14 KB,
patch
|
billm
:
review+
|
Details | Diff | Splinter Review |
It has some fields that are malloced, and that get freed in the destructor. Therefore it needs an operator=. This came up in bug 911204.
Assignee | ||
Comment 1•11 years ago
|
||
Ooo, that's nasty. Brian's solution of bug 911204 seems good to be. Maybe it's better to just delete the copy-operator footguns.
Assignee | ||
Comment 2•11 years ago
|
||
Attachment #798575 -
Flags: review?(wmccloskey)
Reporter | ||
Comment 3•11 years ago
|
||
Comment on attachment 798575 [details] [diff] [review] remove copy and assignment operators of CompileError Review of attachment 798575 [details] [diff] [review]: ----------------------------------------------------------------- Thanks. ::: js/src/frontend/TokenStream.h @@ +319,5 @@ > void throwError(JSContext *cx); > + > + // CompileError owns raw allocated memory, so disable assignment and copying > + // for safety. > + void operator=(const CompileError &) MOZ_DELETE; I'm not sure how important it is, but usually we make these private.
Attachment #798575 -
Flags: review?(wmccloskey) → review+
Assignee | ||
Comment 4•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/1604454f8d21
Assignee: general → benjamin
Comment 5•11 years ago
|
||
private isn't strictly necessary, rather it's belt-and-suspenders. If the compiler doesn't support = delete, then an access-check failure is a further backstop, and one that happens earlier than link failure from using an undefined function. It doesn't catch users that are friends of the method, to be sure, but it's better than nothing for users with older compilers (actually only MSVC, now, I hear).
Comment 6•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/1604454f8d21
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla26
You need to log in
before you can comment on or make changes to this bug.
Description
•