From 817e1dd8ae6ed6be46c408a7c7ee579888f55e67 Mon Sep 17 00:00:00 2001 From: "victorw@chromium.org" Date: Tue, 22 Jun 2010 18:37:42 +0000 Subject: Fix compiler error in sandbox util in case exception is enabled. Add operator delete that matches the placement form of the operator new. This is required by compiler to generate code to call operator delete in case the object's constructor throws an exception. See http://msdn.microsoft.com/en-us/library/cxdxz3x6.aspx R=rvargas BUG=none TEST=sandbox code compiles if exception is enabled. Review URL: http://codereview.chromium.org/2870017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50486 0039d316-1c4b-4281-b951-d872f2087c98 --- sandbox/src/sandbox_nt_util.cc | 6 ++++++ sandbox/src/sandbox_nt_util.h | 6 ++++++ 2 files changed, 12 insertions(+) (limited to 'sandbox') diff --git a/sandbox/src/sandbox_nt_util.cc b/sandbox/src/sandbox_nt_util.cc index 10399fe..1452c6b 100644 --- a/sandbox/src/sandbox_nt_util.cc +++ b/sandbox/src/sandbox_nt_util.cc @@ -560,6 +560,12 @@ void operator delete(void* memory, sandbox::AllocationType type) { } } +void operator delete(void* memory, sandbox::AllocationType type, + void* near_to) { + UNREFERENCED_PARAMETER(near_to); + operator delete(memory, type); +} + void* __cdecl operator new(size_t size, void* buffer, sandbox::AllocationType type) { UNREFERENCED_PARAMETER(size); diff --git a/sandbox/src/sandbox_nt_util.h b/sandbox/src/sandbox_nt_util.h index 99657f5..7a82302 100644 --- a/sandbox/src/sandbox_nt_util.h +++ b/sandbox/src/sandbox_nt_util.h @@ -13,6 +13,12 @@ void* __cdecl operator new(size_t size, sandbox::AllocationType type, void* near_to = NULL); void __cdecl operator delete(void* memory, sandbox::AllocationType type); +// Add operator delete that matches the placement form of the operator new +// above. This is required by compiler to generate code to call operator delete +// in case the object's constructor throws an exception. +// See http://msdn.microsoft.com/en-us/library/cxdxz3x6.aspx +void __cdecl operator delete(void* memory, sandbox::AllocationType type, + void* near_to); // Regular placement new and delete void* __cdecl operator new(size_t size, void* buffer, -- cgit v1.1