aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/Menu.hh
diff options
context:
space:
mode:
authorPavel Labath <pavelo@centrum.sk>2011-07-02 15:21:24 (GMT)
committerPavel Labath <pavelo@centrum.sk>2011-11-01 09:57:20 (GMT)
commitf2709b26d8af7292f750fc05525ac90ad0d99c41 (patch)
tree794903544922abe2b90af6250de24124cd94d546 /src/FbTk/Menu.hh
parent0584414d3845239202d5ea02da2ce6fb5b1b0cbb (diff)
downloadfluxbox_pavel-f2709b26d8af7292f750fc05525ac90ad0d99c41.zip
fluxbox_pavel-f2709b26d8af7292f750fc05525ac90ad0d99c41.tar.bz2
Store menus if smart pointers (RefCount)
This was originally intended to be a bugfix for an memory error reported by valgrind (accessing freed memory). While debugging it, I found the menu ownership semantics confusing (setInternalMenu() et al.), so I decided to get rid of it and store it in smart pointers everywhere. Looking back, I'm not sure if this was worth all the trouble, but the good news is that the valgrind error disappeared. :)
Diffstat (limited to 'src/FbTk/Menu.hh')
-rw-r--r--src/FbTk/Menu.hh4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/FbTk/Menu.hh b/src/FbTk/Menu.hh
index 4096295..5807592 100644
--- a/src/FbTk/Menu.hh
+++ b/src/FbTk/Menu.hh
@@ -65,14 +65,13 @@ public:
65 /// add empty menu item 65 /// add empty menu item
66 int insert(const FbString &label, int pos=-1); 66 int insert(const FbString &label, int pos=-1);
67 /// add submenu 67 /// add submenu
68 int insert(const FbString &label, Menu *submenu, int pos= -1); 68 int insert(const FbString &label, const RefCount<Menu> &submenu, int pos= -1);
69 /// add menu item 69 /// add menu item
70 int insert(MenuItem *item, int pos=-1); 70 int insert(MenuItem *item, int pos=-1);
71 /// remove an item 71 /// remove an item
72 int remove(unsigned int item); 72 int remove(unsigned int item);
73 /// remove all items 73 /// remove all items
74 void removeAll(); 74 void removeAll();
75 void setInternalMenu(bool val = true) { m_internal_menu = val; }
76 void setAlignment(Alignment a) { m_alignment = a; } 75 void setAlignment(Alignment a) { m_alignment = a; }
77 76
78 /// raise this window 77 /// raise this window
@@ -213,7 +212,6 @@ private:
213 bool m_closing; ///< if we're right clicking on the menu title 212 bool m_closing; ///< if we're right clicking on the menu title
214 bool m_visible; ///< menu visibility 213 bool m_visible; ///< menu visibility
215 bool m_torn; ///< torn from parent 214 bool m_torn; ///< torn from parent
216 bool m_internal_menu; ///< whether we should destroy this menu or if it's managed somewhere else
217 bool m_title_vis; ///< title visibility 215 bool m_title_vis; ///< title visibility
218 216
219 int m_which_sub; 217 int m_which_sub;