diff options
author | Pavel Labath <pavelo@centrum.sk> | 2011-07-02 15:21:24 (GMT) |
---|---|---|
committer | Paul Tagliamonte <paultag@fluxbox.org> | 2012-04-07 02:11:29 (GMT) |
commit | 34649e86c5cbe9c9f231c049a0844afdda5a7db9 (patch) | |
tree | 6e9696e36565e993185c9d265ca6542b77788fd9 /src/Slit.hh | |
parent | 0b0ee8dc504016ffad85ec1dd35875d273cf0179 (diff) | |
download | fluxbox_paul-34649e86c5cbe9c9f231c049a0844afdda5a7db9.zip fluxbox_paul-34649e86c5cbe9c9f231c049a0844afdda5a7db9.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/Slit.hh')
-rw-r--r-- | src/Slit.hh | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Slit.hh b/src/Slit.hh index 9384ad6..f12a740 100644 --- a/src/Slit.hh +++ b/src/Slit.hh | |||
@@ -117,7 +117,7 @@ public: | |||
117 | Placement placement() const { return *m_rc_placement; } | 117 | Placement placement() const { return *m_rc_placement; } |
118 | int getOnHead() const { return *m_rc_on_head; } | 118 | int getOnHead() const { return *m_rc_on_head; } |
119 | void saveOnHead(int head); | 119 | void saveOnHead(int head); |
120 | FbTk::Menu &menu() { return m_slitmenu; } | 120 | FbTk::Menu &menu() { return *m_slitmenu; } |
121 | 121 | ||
122 | const FbTk::FbWindow &window() const { return frame.window; } | 122 | const FbTk::FbWindow &window() const { return frame.window; } |
123 | 123 | ||
@@ -147,10 +147,10 @@ private: | |||
147 | BScreen &m_screen; | 147 | BScreen &m_screen; |
148 | FbTk::Timer m_timer; | 148 | FbTk::Timer m_timer; |
149 | 149 | ||
150 | std::auto_ptr<LayerMenu> m_layermenu; | 150 | FbTk::RefCount<LayerMenu> m_layermenu; |
151 | FbMenu m_clientlist_menu, m_slitmenu; | 151 | FbTk::RefCount<FbMenu> m_clientlist_menu, m_slitmenu; |
152 | #ifdef XINERAMA | 152 | #ifdef XINERAMA |
153 | XineramaHeadMenu<Slit> *m_xineramaheadmenu; | 153 | FbTk::RefCount<XineramaHeadMenu<Slit> > m_xineramaheadmenu; |
154 | #endif // XINERAMA | 154 | #endif // XINERAMA |
155 | 155 | ||
156 | struct frame { | 156 | struct frame { |