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>2011-11-01 09:57:20 (GMT)
commitf2709b26d8af7292f750fc05525ac90ad0d99c41 (patch)
tree794903544922abe2b90af6250de24124cd94d546 /src/Workspace.cc
parent0584414d3845239202d5ea02da2ce6fb5b1b0cbb (diff)
downloadfluxbox_paul-f2709b26d8af7292f750fc05525ac90ad0d99c41.zip
fluxbox_paul-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/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/**