aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/FbTk/ImageImlib2.cc23
-rw-r--r--src/FbTk/ImageImlib2.hh1
2 files changed, 11 insertions, 13 deletions
diff --git a/src/FbTk/ImageImlib2.cc b/src/FbTk/ImageImlib2.cc
index 5bac7a4..69fc333 100644
--- a/src/FbTk/ImageImlib2.cc
+++ b/src/FbTk/ImageImlib2.cc
@@ -30,11 +30,20 @@
30 30
31namespace { 31namespace {
32 32
33typedef std::map<int, Imlib_Context> ScreenImlibContextContainer; 33class ScreenImlibContextContainer : public std::map<int, Imlib_Context> {
34public:
35 ~ScreenImlibContextContainer() {
36
37 std::map<int, Imlib_Context>::iterator it = this->begin();
38 std::map<int, Imlib_Context>::iterator it_end = this->end();
39 for (; it != it_end; it++) {
40 imlib_context_free(it->second);
41 }
42 }
43};
34typedef ScreenImlibContextContainer::iterator ScreenImlibContext; 44typedef ScreenImlibContextContainer::iterator ScreenImlibContext;
35 45
36ScreenImlibContextContainer contexts; 46ScreenImlibContextContainer contexts;
37
38} // anon namespace 47} // anon namespace
39 48
40 49
@@ -69,16 +78,6 @@ ImageImlib2::ImageImlib2() {
69 } 78 }
70} 79}
71 80
72ImageImlib2::~ImageImlib2() {
73
74 ScreenImlibContext it = contexts.begin();
75 ScreenImlibContext it_end = contexts.end();
76 for (; it != it_end; it++) {
77 imlib_context_free(it->second);
78 }
79 contexts.clear();
80}
81
82PixmapWithMask *ImageImlib2::load(const std::string &filename, int screen_num) const { 81PixmapWithMask *ImageImlib2::load(const std::string &filename, int screen_num) const {
83 82
84 Display *dpy = FbTk::App::instance()->display(); 83 Display *dpy = FbTk::App::instance()->display();
diff --git a/src/FbTk/ImageImlib2.hh b/src/FbTk/ImageImlib2.hh
index 21bb854..b5da5a1 100644
--- a/src/FbTk/ImageImlib2.hh
+++ b/src/FbTk/ImageImlib2.hh
@@ -28,7 +28,6 @@ namespace FbTk {
28class ImageImlib2: public ImageBase { 28class ImageImlib2: public ImageBase {
29public: 29public:
30 ImageImlib2(); 30 ImageImlib2();
31 ~ImageImlib2();
32 PixmapWithMask *load(const std::string &filename, int screen_num) const; 31 PixmapWithMask *load(const std::string &filename, int screen_num) const;
33}; 32};
34 33