Fix removing windows from icon list

std::remove_if() removes an item from a container and returns a
past-the-end iterator ... which equals m_icon_list.end(). As a result
the check

    if (erase_it != m_icon_list.end()) {
        iconList().erase(erase_it);
        iconListSig().emit(*this);
    }

will never succeed and thus the iconListSig() will never be emitted.
This commit is contained in:
Mathias Gumz 2015-01-22 10:09:08 +01:00
parent 1ec4fb6b6c
commit 5428edf3da

View file

@ -797,9 +797,9 @@ void BScreen::removeIcon(FluxboxWindow *w) {
if (w == 0)
return;
Icons::iterator erase_it = remove_if(iconList().begin(),
iconList().end(),
bind2nd(equal_to<FluxboxWindow *>(), w));
Icons::iterator erase_it = find_if(iconList().begin(),
iconList().end(),
bind2nd(equal_to<FluxboxWindow *>(), w));
// no need to send iconlist signal if we didn't
// change the iconlist
if (erase_it != m_icon_list.end()) {