all repos — fluxbox @ 2628a0a4cfae6d45f8d3115fecb6ede3f8da02e6

custom fork of the fluxbox windowmanager

clean up resources on shutdown
Mathias Gumz akira at fluxbox dot org
commit

2628a0a4cfae6d45f8d3115fecb6ede3f8da02e6

parent

3fa30a4c823249526ce1d71f2cbf1a1be1a93c4b

1 files changed, 12 insertions(+), 10 deletions(-)

jump to
M src/FbTk/FbPixmap.ccsrc/FbTk/FbPixmap.cc

@@ -29,6 +29,7 @@

#include <X11/Xutil.h> #include <X11/Xatom.h> #include <iostream> +#include <vector> #ifdef HAVE_CSTRING #include <cstring> #else

@@ -41,7 +42,7 @@ namespace FbTk {

namespace { -Pixmap *root_pixmaps = 0; +std::vector <Pixmap> s_root_pixmaps; struct RootProps { const char* name;

@@ -409,14 +410,15 @@ }

// returns whether or not the background was changed bool FbPixmap::setRootPixmap(int screen_num, Pixmap pm) { - if (!root_pixmaps) { - root_pixmaps = new Pixmap[ScreenCount(display())]; - for (int i=0; i < ScreenCount(display()); ++i) - root_pixmaps[i] = None; + + if (s_root_pixmaps.empty()) { + int i; + for (i = 0; i < ScreenCount(display()); ++i) + s_root_pixmaps.push_back(None); } - if (root_pixmaps[screen_num] != pm) { - root_pixmaps[screen_num] = pm; + if (s_root_pixmaps[screen_num] != pm) { + s_root_pixmaps[screen_num] = pm; FbWindow::updatedAlphaBackground(screen_num); return true; }

@@ -430,8 +432,8 @@ return None;

*/ // check and see if if we have the pixmaps in cache - if (root_pixmaps && !force_update) - return root_pixmaps[screen_num]; + if (!s_root_pixmaps.empty() && !force_update) + return s_root_pixmaps[screen_num]; checkAtoms();

@@ -481,7 +483,7 @@ }

setRootPixmap(i, root_pm); } - return root_pixmaps[screen_num]; + return s_root_pixmaps[screen_num]; } void FbPixmap::free() {