aboutsummaryrefslogtreecommitdiff
path: root/src/Workspace.cc
diff options
context:
space:
mode:
authorPavel Labath <pavelo@centrum.sk>2011-07-02 15:21:24 (GMT)
committerPavel Labath <pavelo@centrum.sk>2013-02-17 00:09:35 (GMT)
commitb9de0c5be3022db926e167fbe765dc222c1db828 (patch)
tree3af2cb3b644e2986d904f486fe73a5e158757009 /src/Workspace.cc
parentdb435c66cce9644abf5599f62229426b1f09a9e3 (diff)
downloadfluxbox_pavel-b9de0c5be3022db926e167fbe765dc222c1db828.zip
fluxbox_pavel-b9de0c5be3022db926e167fbe765dc222c1db828.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/Workspace.cc')
-rw-r--r--src/Workspace.cc12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/Workspace.cc b/src/Workspace.cc
index a162b4c..8b3c411 100644
--- a/src/Workspace.cc
+++ b/src/Workspace.cc
@@ -65,17 +65,15 @@ using std::string;
65 65
66Workspace::Workspace(BScreen &scrn, const string &name, unsigned int id): 66Workspace::Workspace(BScreen &scrn, const string &name, unsigned int id):
67 m_screen(scrn), 67 m_screen(scrn),
68 m_clientmenu(scrn, m_windowlist, false), 68 m_clientmenu(new ClientMenu(scrn, m_windowlist, false) ),
69 m_name(name), 69 m_name(name),
70 m_id(id) { 70 m_id(id) {
71 71
72 m_clientlist_sig.connect(FbTk::MemFun(m_clientmenu, 72 m_clientlist_sig.connect(FbTk::MemFun(*m_clientmenu,
73 &ClientMenu::refreshMenu)); 73 &ClientMenu::refreshMenu));
74 74
75 menu().setInternalMenu();
76 setName(name); 75 setName(name);
77 76
78
79} 77}
80 78
81 79
@@ -145,7 +143,7 @@ void Workspace::removeAll(unsigned int dest) {
145 143
146 144
147void Workspace::reconfigure() { 145void Workspace::reconfigure() {
148 menu().reconfigure(); 146 menu()->reconfigure();
149 147
150 Windows::iterator it = m_windowlist.begin(); 148 Windows::iterator it = m_windowlist.begin();
151 Windows::iterator it_end = m_windowlist.end(); 149 Windows::iterator it_end = m_windowlist.end();
@@ -176,8 +174,8 @@ void Workspace::setName(const string &name) {
176 174
177 screen().updateWorkspaceName(m_id); 175 screen().updateWorkspaceName(m_id);
178 176
179 menu().setLabel(FbTk::BiDiString(m_name)); 177 menu()->setLabel(FbTk::BiDiString(m_name));
180 menu().updateMenu(); 178 menu()->updateMenu();
181} 179}
182 180
183/** 181/**