platform2: Enforce virtual destructors on base classes
There have been a number of memory leak issues due to absence of
virtual destructors on base classes. Swept through the following targets:
buffet, libchromeos, webserver.
For every class defined, I did one of the following three things:
1. If the class is not meant to be derived from, marked it as 'final'.
2. If classes derived from a particular base class are not meant to be
deleted through the base class, marked the base class's destructor
as 'protected'.
3. Otherwise made the base class's destructor virtual.
BUG=None
TEST=`FEATURES=test emerge-link libchromeos webserver buffet`
Change-Id: I4d909399896d025c39980c9546b79b145614fc47
Reviewed-on: https://chromium-review.googlesource.com/273000
Trybot-Ready: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Vitaly Buka <vitalybuka@chromium.org>
Commit-Queue: Vitaly Buka <vitalybuka@chromium.org>
diff --git a/buffet/notification/xmpp_stream_parser.h b/buffet/notification/xmpp_stream_parser.h
index 6bb39c7..9ff9200 100644
--- a/buffet/notification/xmpp_stream_parser.h
+++ b/buffet/notification/xmpp_stream_parser.h
@@ -47,6 +47,9 @@
std::map<std::string, std::string> attributes) = 0;
virtual void OnStreamEnd(const std::string& node_name) = 0;
virtual void OnStanza(std::unique_ptr<XmlNode> stanza) = 0;
+
+ protected:
+ virtual ~Delegate() = default;
};
explicit XmppStreamParser(Delegate* delegate);