summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2008-05-18 12:47:08 +0000
committerglx <glx@openttd.org>2008-05-18 12:47:08 +0000
commite82bab5323c61583a4ecbbc6107ba9d38eb6aa78 (patch)
tree87b22c169689809958a9ce00c78d4fbede4ad631
parentfc4393dcfee86962549736b429f69cc551ea1ab3 (diff)
downloadopenttd-e82bab5323c61583a4ecbbc6107ba9d38eb6aa78.tar.xz
(svn r13161) -Fix: free the blitter list when the last blitter is removed.
-rw-r--r--src/blitter/factory.hpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/blitter/factory.hpp b/src/blitter/factory.hpp
index e991ed8d6..bd0a6daa8 100644
--- a/src/blitter/factory.hpp
+++ b/src/blitter/factory.hpp
@@ -56,7 +56,13 @@ public:
name(NULL)
{}
- virtual ~BlitterFactoryBase() { if (this->name != NULL) GetBlitters().erase(this->name); free(this->name); }
+ virtual ~BlitterFactoryBase()
+ {
+ if (this->name == NULL) return;
+ GetBlitters().erase(this->name);
+ if (GetBlitters().empty()) delete &GetBlitters();
+ free(this->name);
+ }
/**
* Find the requested blitter and return his class.