Class delete call unsized delete when size not known.
Some classes directly call global operator new to reserve space in addition to the space the class will occupy. These clases must be deleted with the unsized global operator new. If a build is configured such that sized global operator new is called from a delete expression, this must be overridden by such classes. TBR=reed Only affects private bits of SkData. Change-Id: I797935db17a37aa8c2ca7b562a4ea65a7978a9f0 Reviewed-on: https://skia-review.googlesource.com/3678 Reviewed-by: Ben Wagner <bungeman@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Ben Wagner <bungeman@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
This commit is contained in:
parent
f4ace0124f
commit
e1d6ff172e
@ -168,6 +168,9 @@ private:
|
|||||||
explicit SkData(size_t size); // inplace new/delete
|
explicit SkData(size_t size); // inplace new/delete
|
||||||
~SkData();
|
~SkData();
|
||||||
|
|
||||||
|
// Ensure the unsized delete is called.
|
||||||
|
void operator delete(void* p) { ::operator delete(p); }
|
||||||
|
|
||||||
// Called the first time someone calls NewEmpty to initialize the singleton.
|
// Called the first time someone calls NewEmpty to initialize the singleton.
|
||||||
friend SkData* sk_new_empty_data();
|
friend SkData* sk_new_empty_data();
|
||||||
|
|
||||||
|
@ -25,6 +25,9 @@ public:
|
|||||||
return std::unique_ptr<SkDescriptor>(static_cast<SkDescriptor*>(::operator new (length)));
|
return std::unique_ptr<SkDescriptor>(static_cast<SkDescriptor*>(::operator new (length)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure the unsized delete is called.
|
||||||
|
void operator delete(void* p) { ::operator delete(p); }
|
||||||
|
|
||||||
void init() {
|
void init() {
|
||||||
fLength = sizeof(SkDescriptor);
|
fLength = sizeof(SkDescriptor);
|
||||||
fCount = 0;
|
fCount = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user