diff options
Diffstat (limited to 'src/FbTk')
-rw-r--r-- | src/FbTk/ImageImlib2.cc | 23 | ||||
-rw-r--r-- | src/FbTk/ImageImlib2.hh | 1 |
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 | ||
31 | namespace { | 31 | namespace { |
32 | 32 | ||
33 | typedef std::map<int, Imlib_Context> ScreenImlibContextContainer; | 33 | class ScreenImlibContextContainer : public std::map<int, Imlib_Context> { |
34 | public: | ||
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 | }; | ||
34 | typedef ScreenImlibContextContainer::iterator ScreenImlibContext; | 44 | typedef ScreenImlibContextContainer::iterator ScreenImlibContext; |
35 | 45 | ||
36 | ScreenImlibContextContainer contexts; | 46 | ScreenImlibContextContainer contexts; |
37 | |||
38 | } // anon namespace | 47 | } // anon namespace |
39 | 48 | ||
40 | 49 | ||
@@ -69,16 +78,6 @@ ImageImlib2::ImageImlib2() { | |||
69 | } | 78 | } |
70 | } | 79 | } |
71 | 80 | ||
72 | ImageImlib2::~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 | |||
82 | PixmapWithMask *ImageImlib2::load(const std::string &filename, int screen_num) const { | 81 | PixmapWithMask *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 { | |||
28 | class ImageImlib2: public ImageBase { | 28 | class ImageImlib2: public ImageBase { |
29 | public: | 29 | public: |
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 | ||