Summary: | Mismatched new[] / delete in ByteArray | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Dean McNamee <deanm> | ||||
Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | CC: | oliver | ||||
Priority: | P2 | ||||||
Version: | 528+ (Nightly build) | ||||||
Hardware: | PC | ||||||
OS: | OS X 10.5 | ||||||
Attachments: |
|
Description
Dean McNamee
2009-01-14 05:43:54 PST
One option that might be generally useful is to make RefCounted take a traits, in which Traits::destroy(Type*) is responsible for destroying the object. The trait would default to something like DefaultRefCountedTrait, which would implement the destroy(Type*) as a delete T; ByteArray could then supply it's own to do the proper ByteArray::~ByteArray() destructor, and then delete[]. I can try to make this patch, but I imagine any modifications to RefCounted as controversial, so I'll wait for some feedback. Thanks It's important that new/delete and new[]/delete[] match, but I don't see how an array could be a RefCounted. Let me take a look. OK, I see now. I don't think we should add traits to RefCounted just so it can be used by ByteArray, though. It doesn't need to inherit from RefCounted. I think it should just inherit from RefCountedBase and implement its own deref function. Created attachment 26717 [details]
Patch attempt.
Comment on attachment 26717 [details]
Patch attempt.
r=me
Comment on attachment 26717 [details]
Patch attempt.
r=me, do you have commit rights? (i lose track)
I don't, so feel free to commit it for me. Thanks. Committing to http://svn.webkit.org/repository/webkit/trunk ... M JavaScriptCore/ChangeLog M JavaScriptCore/runtime/ByteArray.h Committed r39897 |