diff options
| author | Vaxry <vaxry@vaxry.net> | 2026-01-05 16:21:05 +0100 |
|---|---|---|
| committer | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2026-01-05 18:53:29 +0100 |
| commit | a492fa38661f0791ca72ff87a112117e5dbd5965 (patch) | |
| tree | 59ed255a496c54bba2e82fd2175104c374a5272d /src/desktop/view/Window.cpp | |
| parent | e165f841849114780c3fdc40a1b959470d51a5e2 (diff) | |
desktop/window: catch bad any cast tokens
Diffstat (limited to 'src/desktop/view/Window.cpp')
| -rw-r--r-- | src/desktop/view/Window.cpp | 20 |
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); } } } } |
