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
commitca27e25ab092a403bcc44ce8219c89d2dc3c4285 (patch)
tree87b22c169689809958a9ce00c78d4fbede4ad631
parent4d5b9e38d60a4199dc36a6d275ca8e31f1b7f97c (diff)
downloadopenttd-ca27e25ab092a403bcc44ce8219c89d2dc3c4285.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.