From 3f5b1a3b47a2d941df3e6122ac4f64ee129fb74f Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 24 Jan 2011 15:08:23 -0800 Subject: [PATCH] Erase the decoder factory when it's deleted --- src/streamdec.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/streamdec.cpp b/src/streamdec.cpp index 8b8c8fa..0a03eea 100644 --- a/src/streamdec.cpp +++ b/src/streamdec.cpp @@ -53,7 +53,7 @@ protected: return std::auto_ptr(); } - static const ListType& AddList(FactoryType func) + static ListType& AddList(FactoryType func) { static ListType FuncList; if(func) FuncList.push_back(func); @@ -63,6 +63,11 @@ protected: template struct DecoderDecl : public Decoder { DecoderDecl() { AddList(Factory); } + ~DecoderDecl() + { + ListType &list = AddList(NULL); + list.erase(std::find(list.begin(), list.end(), Factory)); + } }; -- 2.11.4.GIT