summaryrefslogtreecommitdiff
path: root/wx+/image_resources.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'wx+/image_resources.cpp')
-rw-r--r--wx+/image_resources.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/wx+/image_resources.cpp b/wx+/image_resources.cpp
index 98cdc7a8..4ba62bb9 100644
--- a/wx+/image_resources.cpp
+++ b/wx+/image_resources.cpp
@@ -50,12 +50,18 @@ public:
}
void init(const Zstring& filepath);
+ void cleanup()
+ {
+ bitmaps.clear();
+ anims.clear();
+ }
const wxBitmap& getImage (const wxString& name) const;
const wxAnimation& getAnimation(const wxString& name) const;
private:
GlobalResources() {}
+ ~GlobalResources() { assert(bitmaps.empty() && anims.empty()); } //don't leave wxWidgets objects for static destruction!
GlobalResources (const GlobalResources&) = delete;
GlobalResources& operator=(const GlobalResources&) = delete;
@@ -127,6 +133,7 @@ const wxAnimation& GlobalResources::getAnimation(const wxString& name) const
void zen::initResourceImages(const Zstring& filepath) { GlobalResources::instance().init(filepath); }
+void zen::cleanupResourceImages() { GlobalResources::instance().cleanup(); }
const wxBitmap& zen::getResourceImage(const wxString& name) { return GlobalResources::instance().getImage(name); }
bgstack15