aboutsummaryrefslogtreecommitdiff
path: root/x11-wm/fluxbox/files/patch-fix_pixmap_resource_leak
diff options
context:
space:
mode:
Diffstat (limited to 'x11-wm/fluxbox/files/patch-fix_pixmap_resource_leak')
-rw-r--r--x11-wm/fluxbox/files/patch-fix_pixmap_resource_leak102
1 files changed, 102 insertions, 0 deletions
diff --git a/x11-wm/fluxbox/files/patch-fix_pixmap_resource_leak b/x11-wm/fluxbox/files/patch-fix_pixmap_resource_leak
new file mode 100644
index 000000000000..9ccef938b86e
--- /dev/null
+++ b/x11-wm/fluxbox/files/patch-fix_pixmap_resource_leak
@@ -0,0 +1,102 @@
+From 91408776f0b04dbc5a5da99f555b33f9abc5a905 Mon Sep 17 00:00:00 2001
+From: Henrik Kinnunen <fluxgen@fluxbox.org>
+Date: Sun, 14 Sep 2008 21:36:16 +0200
+Subject: [PATCH] Fixed a pixmap resource leak with selected pixmap in menus.
+
+menu.hilite.selected.pixmap and menu.selected.pixmap was not
+deleted while switching between non-pixmap styles and pixmap styles.
+---
+ ChangeLog | 3 +++
+ src/FbTk/ImageControl.cc | 9 ++++++++-
+ src/FbTk/ImageControl.hh | 5 ++++-
+ src/FbTk/Menu.cc | 18 +++++++++++++++---
+ 4 files changed, 30 insertions(+), 5 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+--- a/ChangeLog
++++ ChangeLog
+@@ -1,5 +1,8 @@
+ (Format: Year/Month/Day)
+ Changes for 1.1
++*08/09/14:
++ * Fixed a minor pixmap resource leak (Henrik)
++ FbTk/Menu.cc, FbTk/ImageControl.cc/hh
+ *08/09/01:
+ * When the current menu item gets disabled, highlight its nearest neighbor
+ and add separators to the focus model menu (Mark)
+diff --git a/src/FbTk/ImageControl.cc b/src/FbTk/ImageControl.cc
+--- a/src/FbTk/ImageControl.cc
++++ src/FbTk/ImageControl.cc
+@@ -227,11 +227,18 @@ Pixmap ImageControl::searchCache(unsigned int width, unsigned int height,
+
+ Pixmap ImageControl::renderImage(unsigned int width, unsigned int height,
+ const FbTk::Texture &texture,
+- FbTk::Orientation orient) {
++ FbTk::Orientation orient,
++ bool use_cache ) {
+
+ if (texture.type() & FbTk::Texture::PARENTRELATIVE)
+ return ParentRelative;
+
++ // If we are not suppose to cache this pixmap, just render and return it
++ if ( ! use_cache) {
++ TextureRender image(*this, width, height, orient, m_colors, m_num_colors);
++ return image.render(texture);
++ }
++
+ // search cache first
+ Pixmap pixmap = searchCache(width, height, texture, orient);
+ if (pixmap) {
+diff --git a/src/FbTk/ImageControl.hh b/src/FbTk/ImageControl.hh
+--- a/src/FbTk/ImageControl.hh
++++ src/FbTk/ImageControl.hh
+@@ -54,11 +54,14 @@ public:
+ @param width width of pixmap
+ @param height height of pixmap
+ @param src_texture texture type to render
++ @param orient Orientation of the texture.
++ @param use_cache whether or not to use cache
+ @return pixmap of the rendered image, on failure None
+ */
+ Pixmap renderImage(unsigned int width, unsigned int height,
+ const FbTk::Texture &src_texture,
+- Orientation orient = ROT0);
++ Orientation orient = ROT0,
++ bool use_cache = true);
+
+ void installRootColormap();
+ void removeImage(Pixmap thepix);
+diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc
+--- a/src/FbTk/Menu.cc
++++ src/FbTk/Menu.cc
+@@ -460,12 +460,24 @@ void Menu::updateMenu(int active_index) {
+
+ if (!theme()->selectedPixmap().pixmap().drawable()) {
+ int hw = theme()->itemHeight() / 2;
+- theme()->setSelectedPixmap(m_image_ctrl.renderImage(hw, hw, theme()->hiliteTexture()), true);
++ // render image, disable cache and let the theme remove the pixmap
++ theme()->setSelectedPixmap(m_image_ctrl.
++ renderImage(hw, hw,
++ theme()->hiliteTexture(), ROT0,
++ false // no cache
++ ),
++ false); // the theme takes care of this pixmap
+
+ if (!theme()->highlightSelectedPixmap().pixmap().drawable()) {
+ int hw = theme()->itemHeight() / 2;
+- theme()->setHighlightSelectedPixmap(m_image_ctrl.renderImage(hw, hw, theme()->frameTexture()), true);
+- }
++ // render image, disable cache and let the theme remove the pixmap
++ theme()->setHighlightSelectedPixmap(m_image_ctrl.
++ renderImage(hw, hw,
++ theme()->frameTexture(), ROT0,
++ false // no cache
++ ),
++ false); // theme takes care of this pixmap
++ }
+ }
+
+ if (m_title_vis) {
+--
+1.6.0.1
+