summaryrefslogtreecommitdiff
path: root/src/desktop/view/Window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/desktop/view/Window.cpp')
-rw-r--r--src/desktop/view/Window.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/desktop/view/Window.cpp b/src/desktop/view/Window.cpp
index a22f4a9d..4a2d46a9 100644
--- a/src/desktop/view/Window.cpp
+++ b/src/desktop/view/Window.cpp
@@ -463,11 +463,13 @@ void CWindow::moveToWorkspace(PHLWORKSPACE pWorkspace) {
if (TOKEN) {
if (*PINITIALWSTRACKING == 2) {
// persistent
- SInitialWorkspaceToken token = std::any_cast<SInitialWorkspaceToken>(TOKEN->m_data);
- if (token.primaryOwner == m_self) {
- token.workspace = pWorkspace->getConfigName();
- TOKEN->m_data = token;
- }
+ try {
+ SInitialWorkspaceToken token = std::any_cast<SInitialWorkspaceToken>(TOKEN->m_data);
+ if (token.primaryOwner == m_self) {
+ token.workspace = pWorkspace->getConfigName();
+ TOKEN->m_data = token;
+ }
+ } catch (const std::bad_any_cast& e) { ; }
}
}
}
@@ -553,9 +555,11 @@ void CWindow::onUnmap() {
if (TOKEN) {
if (*PINITIALWSTRACKING == 2) {
// persistent token, but the first window got removed so the token is gone
- SInitialWorkspaceToken token = std::any_cast<SInitialWorkspaceToken>(TOKEN->m_data);
- if (token.primaryOwner == m_self)
- g_pTokenManager->removeToken(TOKEN);
+ try {
+ SInitialWorkspaceToken token = std::any_cast<SInitialWorkspaceToken>(TOKEN->m_data);
+ if (token.primaryOwner == m_self)
+ g_pTokenManager->removeToken(TOKEN);
+ } catch (const std::bad_any_cast& e) { g_pTokenManager->removeToken(TOKEN); }
}
}
}