aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPavel Labath <pavelo@centrum.sk>2011-08-08 11:31:25 (GMT)
committerPavel Labath <pavelo@centrum.sk>2011-09-14 17:39:11 (GMT)
commite54bca68d2bd42f9b9c342a1564971db6e071808 (patch)
tree61f149ac9e1d7575f5da5aeaf1501c044a9e5f68 /src
parentaa84c952535a86e797226a2fe3bc5f41248c93c1 (diff)
downloadfluxbox-e54bca68d2bd42f9b9c342a1564971db6e071808.zip
fluxbox-e54bca68d2bd42f9b9c342a1564971db6e071808.tar.bz2
Make sure FocusableList disconnects from signals when it is destroyed
Diffstat (limited to 'src')
-rw-r--r--src/FocusableList.cc13
-rw-r--r--src/FocusableList.hh13
2 files changed, 11 insertions, 15 deletions
diff --git a/src/FocusableList.cc b/src/FocusableList.cc
index 3373890..382a6f5 100644
--- a/src/FocusableList.cc
+++ b/src/FocusableList.cc
@@ -94,7 +94,11 @@ FocusableList::FocusableList(BScreen &scr, const FocusableList &parent,
94 94
95void FocusableList::init() { 95void FocusableList::init() {
96 addMatching(); 96 addMatching();
97 m_parent->attachChild(*this); 97
98 join(m_parent->addSig(), FbTk::MemFun(*this, &FocusableList::parentWindowAdded));
99 join(m_parent->orderSig(), FbTk::MemFun(*this, &FocusableList::parentOrderChanged));
100 join(m_parent->removeSig(), FbTk::MemFun(*this, &FocusableList::parentWindowRemoved));
101 join(m_parent->resetSig(), FbTk::MemFun(*this, &FocusableList::reset));
98 102
99 // TODO: can't handle (head=[mouse]) yet 103 // TODO: can't handle (head=[mouse]) yet
100 if (m_pat->dependsOnCurrentWorkspace()) { 104 if (m_pat->dependsOnCurrentWorkspace()) {
@@ -291,13 +295,6 @@ Focusable *FocusableList::find(const ClientPattern &pat) const {
291 return 0; 295 return 0;
292} 296}
293 297
294void FocusableList::attachChild(FocusableList &child) const {
295 m_addsig.connect(FbTk::MemFun(child, &FocusableList::parentWindowAdded));
296 m_ordersig.connect(FbTk::MemFun(child, &FocusableList::parentOrderChanged));
297 m_removesig.connect(FbTk::MemFun(child, &FocusableList::parentWindowRemoved));
298 m_resetsig.connect(FbTk::MemFun(child, &FocusableList::reset));
299}
300
301void FocusableList::workspaceChanged(BScreen &screen) { 298void FocusableList::workspaceChanged(BScreen &screen) {
302 reset(); 299 reset();
303} 300}
diff --git a/src/FocusableList.hh b/src/FocusableList.hh
index 48881d0..a56fdbd 100644
--- a/src/FocusableList.hh
+++ b/src/FocusableList.hh
@@ -78,10 +78,10 @@ public:
78 @name signals 78 @name signals
79 @{ 79 @{
80 */ 80 */
81 FbTk::Signal<Focusable *> &orderSig() { return m_ordersig; } 81 const FbTk::Signal<Focusable *> &orderSig() const { return m_ordersig; }
82 FbTk::Signal<Focusable *> &addSig() { return m_addsig; } 82 const FbTk::Signal<Focusable *> &addSig() const { return m_addsig; }
83 FbTk::Signal<Focusable *> &removeSig() { return m_removesig; } 83 const FbTk::Signal<Focusable *> &removeSig() const { return m_removesig; }
84 FbTk::Signal<> &resetSig() { return m_resetsig; } 84 const FbTk::Signal<> &resetSig() const { return m_resetsig; }
85 /** @} */ // end group signals 85 /** @} */ // end group signals
86 86
87private: 87private:
@@ -91,7 +91,6 @@ private:
91 bool insertFromParent(Focusable &win); 91 bool insertFromParent(Focusable &win);
92 void attachSignals(Focusable &win); 92 void attachSignals(Focusable &win);
93 void reset(); 93 void reset();
94 void attachChild(FocusableList &child) const;
95 void workspaceChanged(BScreen &screen); 94 void workspaceChanged(BScreen &screen);
96 void focusedWindowChanged(BScreen &screen, FluxboxWindow *win, WinClient *client); 95 void focusedWindowChanged(BScreen &screen, FluxboxWindow *win, WinClient *client);
97 /// Title has changed for a window 96 /// Title has changed for a window
@@ -108,8 +107,8 @@ private:
108 BScreen &m_screen; 107 BScreen &m_screen;
109 std::list<Focusable *> m_list; 108 std::list<Focusable *> m_list;
110 109
111 mutable FbTk::Signal<Focusable *> m_ordersig, m_addsig, m_removesig; 110 FbTk::Signal<Focusable *> m_ordersig, m_addsig, m_removesig;
112 mutable FbTk::Signal<> m_resetsig; 111 FbTk::Signal<> m_resetsig;
113 typedef std::map<Focusable*, FbTk::RefCount<FbTk::SignalTracker> > SignalMap; 112 typedef std::map<Focusable*, FbTk::RefCount<FbTk::SignalTracker> > SignalMap;
114 SignalMap m_signal_map; 113 SignalMap m_signal_map;
115}; 114};