bugfix: crash when cleaning up signals

22fa5f544b was not fixing anything, the real cause is that the
SignalHolder still has a reference to a not existing Tracker.
This commit is contained in:
Mathias Gumz 2010-05-07 09:36:30 +02:00
parent 615e9cec32
commit bca59851f3

View file

@ -117,7 +117,6 @@ public:
SlotID connect(const SlotType& slot) { SlotID connect(const SlotType& slot) {
return SignalHolder::connect(slot); return SignalHolder::connect(slot);
} }
}; };
@ -243,8 +242,14 @@ public:
/// Leave tracking for a signal /// Leave tracking for a signal
/// @param id the \c id from the previous \c join /// @param id the \c id from the previous \c join
void leave(TrackID id) { void leave(TrackID id, bool disconnect = false) {
// keep temporary, while disconnecting we can
// in some strange cases get a call to this again
ValueType tmp = *id;
m_connections.erase(id); m_connections.erase(id);
if (disconnect)
tmp.first->disconnect(tmp.second);
tmp.first->disconnectTracker(*this);
} }
/// Leave tracking for a signal /// Leave tracking for a signal
@ -253,8 +258,7 @@ public:
void leave(Signal &sig) { void leave(Signal &sig) {
Iterator it = m_connections.find(&sig); Iterator it = m_connections.find(&sig);
if (it != m_connections.end()) { if (it != m_connections.end()) {
it->first->disconnect( it->second ); leave(it);
m_connections.erase(it);
} }
} }
@ -263,12 +267,7 @@ public:
// disconnect all connections // disconnect all connections
for ( Iterator conIt = m_connections.begin(); for ( Iterator conIt = m_connections.begin();
conIt != m_connections.end(); ++conIt) { conIt != m_connections.end(); ++conIt) {
// keep temporary, while disconnecting we can leave(conIt, true);
// in some strange cases get a call to this again
ValueType tmp = *conIt;
m_connections.erase(conIt);
tmp.first->disconnect(tmp.second);
tmp.first->disconnectTracker(*this);
} }
} }