From 55592b9eeaff3d41e5f03b9c0c1566ed508f38a5 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Thu, 27 Dec 2007 17:07:35 +0000 Subject: [PATCH] Add missing virtual destructor to Collection::ItemKeywordBase Add Loader::finish() to handle finishing actions in an exception-safe way --- source/collection.h | 1 + source/loader.cpp | 2 ++ source/loader.h | 2 ++ 3 files changed, 5 insertions(+) diff --git a/source/collection.h b/source/collection.h index f293428..303697a 100644 --- a/source/collection.h +++ b/source/collection.h @@ -72,6 +72,7 @@ private: */ struct ItemKeywordBase { + virtual ~ItemKeywordBase() { } virtual void add_to_loader(Loader &) const { }; }; diff --git a/source/loader.cpp b/source/loader.cpp index 67668cd..284588a 100644 --- a/source/loader.cpp +++ b/source/loader.cpp @@ -16,6 +16,7 @@ void Loader::load(const Statement &st) { for(list::const_iterator i=st.sub.begin(); i!=st.sub.end(); ++i) load_statement(*i); + finish(); } void Loader::load(Parser &p) @@ -26,6 +27,7 @@ void Loader::load(Parser &p) if(st.valid) load_statement(st); } + finish(); } Loader::~Loader() diff --git a/source/loader.h b/source/loader.h index 951eeb0..749c104 100644 --- a/source/loader.h +++ b/source/loader.h @@ -343,6 +343,8 @@ protected: throw InvalidState("get_source called without current statement"); return cur_st->source; } + + virtual void finish() { } private: typedef std::map ActionMap; -- 2.43.0