Descriptionui/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
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=128132
Patch Set 1 #Patch Set 2 : fix unittest #
Messages
Total messages: 5 (0 generated)
|