Give classes with virtual methods virtual protected destructors instead of implicit non-virtual public destructors.
Was originally:
Replace public nonvirtual destructors in classes with virtual members
with protected nonvirtual destructors where possible, and with
public virtual destructors where destruction of a derived class occurs.
(Excluding chrome/browser/...)
(Part 4 of http://www.gotw.ca/publications/mill18.htm
has a rationale for why public nonvirtual destructors in classes with
virtual members is dangerous.)
Patch by: Jacob Mandelson ([email protected])
BUG=none
TEST=base_unittests & app_unittests
Review URL: http://codereview.chromium.org/200106
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34633 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/base/waitable_event.h b/base/waitable_event.h
index 31aa085..8f5962fd 100644
--- a/base/waitable_event.h
+++ b/base/waitable_event.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -121,6 +121,9 @@
// pointers match then this function is called as a final check. See the
// comments in ~Handle for why.
virtual bool Compare(void* tag) = 0;
+
+ protected:
+ virtual ~Waiter() {}
};
private: