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.
This commit is contained in:
parent
9f519ec0fc
commit
91408776f0
4 changed files with 30 additions and 5 deletions
|
@ -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)
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue