all repos — fluxbox @ 16c90dc19fcd68fccbcfb277b3839e7f41fe9dd3

custom fork of the fluxbox windowmanager

Make SignalTracker always disconnect itself from Signals

previously, the tracker disconnected itself only when the caller passed withTracker = true to the
leave() function. However, the default value was for the parameter was false.

Non disconnecting from signal when stopping tracking creates very dangerous situation because the
signal still holds a pointer to the tracker. This resulted in a segfault when exiting fluxbox,
because the tracker (FluxboxWindow) got destroyed before the signal (BScreen::focusedWindowSig),
and the signal was using an invalid pointer when it tried to disconnect itself from the tracker.

Instead of setting withTracker to true by default or changing all invocations of leave(), I
decided to make the tracker disconnect itself unconditionally because I could not find a use case
for the opposite behaviour.

PS: This message is in fact longer than the actual commit.
Pavel Labath pavelo@centrum.sk
commit

16c90dc19fcd68fccbcfb277b3839e7f41fe9dd3

parent

7525ca9f7745a7d8ef4461dc1f3c911498546b00

1 files changed, 3 insertions(+), 4 deletions(-)

jump to
M src/FbTk/Signal.hhsrc/FbTk/Signal.hh

@@ -216,14 +216,13 @@ }

/// Leave tracking for a signal /// @param id the \c id from the previous \c join - void leave(TrackID id, bool withTracker = false) { + void leave(TrackID id) { // keep temporary, while disconnecting we can // in some strange cases get a call to this again ValueType tmp = *id; m_connections.erase(id); tmp.first->disconnect(tmp.second); - if (withTracker) - tmp.first->disconnectTracker(*this); + tmp.first->disconnectTracker(*this); } /// Leave tracking for a signal

@@ -240,7 +239,7 @@

void leaveAll() { // disconnect all connections for ( ; !m_connections.empty(); ) { - leave(m_connections.begin(), true); + leave(m_connections.begin()); } }