diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-22 01:24:56 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-22 01:24:56 +0000 |
commit | 7d778fb3afe9eb0da4ea3c13856491efea43cdde (patch) | |
tree | 2520b6553273bdcf8f3b5322e1b67356d87e8c6e /remoting/webapp | |
parent | 561ddce5b44c0c4d5e9d918da00a451f6c828708 (diff) | |
download | chromium_src-7d778fb3afe9eb0da4ea3c13856491efea43cdde.zip chromium_src-7d778fb3afe9eb0da4ea3c13856491efea43cdde.tar.gz chromium_src-7d778fb3afe9eb0da4ea3c13856491efea43cdde.tar.bz2 |
ui/base/models: Add protected virtual destructor to ComboboxModel.
The use of a protected virtual destructor is to prevent the destruction of a
derived object via a base-class pointer.
That's it, ComboboxModel should only be deleted through derived class.
Example 1:
class FooComboboxModel : public ComboboxModel {
};
ComboboxModel* model = new FooComboboxModel;
delete model; // It should prevent this situation!
Also, a protected virtual destructor makes it clear that someone else owns the
object.
Example 2:
class Foo {
public:
void SetModel(ComboboxModel* model);
};
If you see that the model has a protected destructor, you know Foo doesn't own
|model|.
R=sky@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9817007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128132 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/webapp')
0 files changed, 0 insertions, 0 deletions