diff --git a/CHANGELOG.md b/CHANGELOG.md index a8d03049..7228f259 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `format-offset` being ignored ([`#2643`](https://github.com/polybar/polybar/pull/2643)) - Negative struts (`margin-bottom`, `margin-top`) being ignored ([`#2642`](https://github.com/polybar/polybar/issues/2642), [`#2644`](https://github.com/polybar/polybar/pull/2644)) - Positioning in awesomeWM ([`#2651`](https://github.com/polybar/polybar/pull/2651)) +- `internal/xworkspaces`: The module sometimes crashed polybar when windows were closed. ([`#2655`](https://github.com/polybar/polybar/pull/2655)) ## [3.6.1] - 2022-03-05 ### Build diff --git a/src/modules/xworkspaces.cpp b/src/modules/xworkspaces.cpp index 467e7c16..1e4dd50a 100644 --- a/src/modules/xworkspaces.cpp +++ b/src/modules/xworkspaces.cpp @@ -138,8 +138,18 @@ namespace modules { for (auto&& client : newclients) { if (m_clients.count(client) == 0) { - // new client: listen for changes (wm_hint or desktop) - m_connection.ensure_event_mask(client, XCB_EVENT_MASK_PROPERTY_CHANGE); + try { + // new client: listen for changes (wm_hint or desktop) + m_connection.ensure_event_mask(client, XCB_EVENT_MASK_PROPERTY_CHANGE); + } catch (const xpp::x::error::window& e) { + /* + * The "new client" may have already disappeared between reading the + * client list and setting the event mask. + * This is not a severe issue and it will eventually correct itself + * when a new _NET_CLIENT_LIST value is set. + */ + m_log.info("%s: New client window no longer exists, ignoring..."); + } } }