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-07-02 15:21:24 (GMT)
commit442e69c89b721329883113389f889675138e7da7 (patch)
tree211111eb98eb3da6155baea0a24c5cd9d8c6137d /src/FbTk/Menu.hh
parentbd94eaa6cadfd0a7d83f3068a84b27f987bdee4b (diff)
downloadfluxbox_pavel-442e69c89b721329883113389f889675138e7da7.zip
fluxbox_pavel-442e69c89b721329883113389f889675138e7da7.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;