fix(tray): Clients not being removed properly

The vector::erase call needs to be supplied with the end of the range,
otherwise only a single element is removed.

Fixes #3111
This commit is contained in:
patrick96 2024-04-14 19:52:02 +02:00 committed by Patrick Ziegler
parent c8f7dc1c14
commit ab583b08cd
2 changed files with 5 additions and 2 deletions

View File

@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Token min-length calculations would behave differently when non-ASCII characters appear in the token ([`#3074`](https://github.com/polybar/polybar/issues/3074), [`#3087`](https://github.com/polybar/polybar/pull/3087)) by [@nklloyd](https://github.com/nklloyd)
- i3: Fix duplicated rendering for non-full-width bars ([`#3091`](https://github.com/polybar/polybar/pull/3091), [`#3060`](https://github.com/polybar/polybar/issues/3060))
- `internal/backlight`: Module could display the literal `%percentage%` token if the backlight reports a value of 0 at startup ([`#3081`](https://github.com/polybar/polybar/pull/3081)) by [@unclechu](https://github.com/unclechu)
- `internal/tray`: Fix crash during restarting, when tray icons were not removed proberly ([`#3111`](https://github.com/polybar/polybar/issues/3111), [`#3112`](https://github.com/polybar/polybar/pull/3112))
## [3.7.1] - 2023-11-27
### Build

View File

@ -502,7 +502,8 @@ void manager::remove_client(const client& c) {
void manager::remove_client(xcb_window_t win) {
auto old_size = m_clients.size();
m_clients.erase(
std::remove_if(m_clients.begin(), m_clients.end(), [win](const auto& client) { return client->match(win); }));
std::remove_if(m_clients.begin(), m_clients.end(), [win](const auto& client) { return client->match(win); }),
m_clients.end());
if (old_size != m_clients.size()) {
reconfigure();
@ -518,7 +519,8 @@ void manager::remove_client(xcb_window_t win) {
*/
void manager::clean_clients() {
m_clients.erase(
std::remove_if(m_clients.begin(), m_clients.end(), [](const auto& client) { return client.get() == nullptr; }));
std::remove_if(m_clients.begin(), m_clients.end(), [](const auto& client) { return client.get() == nullptr; }),
m_clients.end());
}
bool manager::change_visibility(bool visible) {