diff options
Diffstat (limited to 'src/FbTk/ImageImlib2.cc')
-rw-r--r-- | src/FbTk/ImageImlib2.cc | 23 |
1 files changed, 11 insertions, 12 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(); |