Closed Bug 488858 Opened 17 years ago Closed 16 years ago

List isn't copy safe

Categories

(Tamarin Graveyard :: Virtual Machine, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED
flash10.1

People

(Reporter: treilly, Assigned: lhansen)

Details

Attachments

(1 file)

Attachments: Hi Tommy - I was debugging a crash and noticed that someone had incorrectly written: struct blah {}; // unmanaged class foo : MMgc::GCFinalizedObject { avmplus::List<blah*> m_list; void set(const amvplus::List<blah*> otherList) { m_list = otherList; // WRONG, no operator= } void set2(const avmplus::List<blah*> otherList) { m_list.clear(); m_list.add(otherList); // RIGHT } }; The symptom was hard to identify at first - m_list.data was double-freed because the automatically provided bitwise-copy operator= just duplicated the data pointer. Poisoned memory helped me figure it out (thank you). What I'm wondering is: should we make it a compile error to use operator= with avmplus::List? Presumably by providing a private operator=? I'd be happy to do the work (easy), but I'm not sure what the procedure is for getting something into avmplus, and also I could be missing some reason why this is a dumb idea. Thanks d.
we either need a copy ctor that makes a copy or make it private and force client to use add
vote for compile error
vote for compile error
Assignee: nobody → lhansen
Target Milestone: --- → flash10.x
(In reply to comment #3) > vote for compile error +1
Hides both the copy constructor and the assignment operator.
Attachment #385722 - Flags: review?(edwsmith)
Attachment #385722 - Flags: review?(edwsmith) → review?(stejohns)
Attachment #385722 - Flags: review?(stejohns) → review+
redux changeset: 2070:6ad0961dbd41
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: