diff options
author | Mathias Gumz <akira at fluxbox dot org> | 2010-05-07 07:36:30 (GMT) |
---|---|---|
committer | Mathias Gumz <akira at fluxbox dot org> | 2010-05-07 07:36:30 (GMT) |
commit | bca59851f396ecb10bfbb13e60e17395490167e5 (patch) | |
tree | a96e3ad678c812d26616e5a2c68a501a6498143d | |
parent | 615e9cec3223d7f4661d2b2140661839929cef5d (diff) | |
download | fluxbox-bca59851f396ecb10bfbb13e60e17395490167e5.zip fluxbox-bca59851f396ecb10bfbb13e60e17395490167e5.tar.bz2 |
bugfix: crash when cleaning up signals
22fa5f544b35 was not fixing anything, the real cause is that the
SignalHolder still has a reference to a not existing Tracker.
-rw-r--r-- | src/FbTk/Signal.hh | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/FbTk/Signal.hh b/src/FbTk/Signal.hh index 06136ba..702f05e 100644 --- a/src/FbTk/Signal.hh +++ b/src/FbTk/Signal.hh | |||
@@ -117,7 +117,6 @@ public: | |||
117 | 117 | ||
118 | SlotID connect(const SlotType& slot) { | 118 | SlotID connect(const SlotType& slot) { |
119 | return SignalHolder::connect(slot); | 119 | return SignalHolder::connect(slot); |
120 | |||
121 | } | 120 | } |
122 | }; | 121 | }; |
123 | 122 | ||
@@ -243,8 +242,14 @@ public: | |||
243 | 242 | ||
244 | /// Leave tracking for a signal | 243 | /// Leave tracking for a signal |
245 | /// @param id the \c id from the previous \c join | 244 | /// @param id the \c id from the previous \c join |
246 | void leave(TrackID id) { | 245 | void leave(TrackID id, bool disconnect = false) { |
246 | // keep temporary, while disconnecting we can | ||
247 | // in some strange cases get a call to this again | ||
248 | ValueType tmp = *id; | ||
247 | m_connections.erase(id); | 249 | m_connections.erase(id); |
250 | if (disconnect) | ||
251 | tmp.first->disconnect(tmp.second); | ||
252 | tmp.first->disconnectTracker(*this); | ||
248 | } | 253 | } |
249 | 254 | ||
250 | /// Leave tracking for a signal | 255 | /// Leave tracking for a signal |
@@ -253,8 +258,7 @@ public: | |||
253 | void leave(Signal &sig) { | 258 | void leave(Signal &sig) { |
254 | Iterator it = m_connections.find(&sig); | 259 | Iterator it = m_connections.find(&sig); |
255 | if (it != m_connections.end()) { | 260 | if (it != m_connections.end()) { |
256 | it->first->disconnect( it->second ); | 261 | leave(it); |
257 | m_connections.erase(it); | ||
258 | } | 262 | } |
259 | } | 263 | } |
260 | 264 | ||
@@ -263,12 +267,7 @@ public: | |||
263 | // disconnect all connections | 267 | // disconnect all connections |
264 | for ( Iterator conIt = m_connections.begin(); | 268 | for ( Iterator conIt = m_connections.begin(); |
265 | conIt != m_connections.end(); ++conIt) { | 269 | conIt != m_connections.end(); ++conIt) { |
266 | // keep temporary, while disconnecting we can | 270 | leave(conIt, true); |
267 | // in some strange cases get a call to this again | ||
268 | ValueType tmp = *conIt; | ||
269 | m_connections.erase(conIt); | ||
270 | tmp.first->disconnect(tmp.second); | ||
271 | tmp.first->disconnectTracker(*this); | ||
272 | } | 271 | } |
273 | } | 272 | } |
274 | 273 | ||