diff --git a/src/effects.cpp b/src/effects.cpp index cc48a13519..228e6887be 100644 --- a/src/effects.cpp +++ b/src/effects.cpp @@ -1994,7 +1994,7 @@ const EffectWindowGroup *EffectWindowImpl::group() const void EffectWindowImpl::refWindow() { - if (auto d = qobject_cast(toplevel)) { + if (auto d = static_cast(toplevel->isDeleted() ? toplevel : nullptr)) { return d->refWindow(); } Q_UNREACHABLE(); // TODO @@ -2002,7 +2002,7 @@ void EffectWindowImpl::refWindow() void EffectWindowImpl::unrefWindow() { - if (auto d = qobject_cast(toplevel)) { + if (auto d = static_cast(toplevel->isDeleted() ? toplevel : nullptr)) { return d->unrefWindow(); // delays deletion in case } Q_UNREACHABLE(); // TODO @@ -2071,7 +2071,7 @@ TOPLEVEL_HELPER(QUuid, internalId, internalId) if (client) { \ return client->propertyname(); \ } \ - auto deleted = qobject_cast(toplevel); \ + auto deleted = static_cast(toplevel->isDeleted() ? toplevel : nullptr); \ if (deleted) { \ return deleted->propertyname(); \ } \ @@ -2240,7 +2240,7 @@ EffectWindowList EffectWindowImpl::mainWindows() const if (auto client = static_cast(toplevel->isClient() ? toplevel : nullptr)) { return getMainWindows(client); } - if (auto deleted = qobject_cast(toplevel)) { + if (auto deleted = static_cast(toplevel->isDeleted() ? toplevel : nullptr)) { return getMainWindows(deleted); } return {}; diff --git a/src/scenes/qpainter/scene_qpainter.cpp b/src/scenes/qpainter/scene_qpainter.cpp index b57fa29171..0653c30ec2 100644 --- a/src/scenes/qpainter/scene_qpainter.cpp +++ b/src/scenes/qpainter/scene_qpainter.cpp @@ -248,7 +248,7 @@ void SceneQPainter::Window::renderDecorationItem(QPainter *painter, DecorationIt QRect dtr, dlr, drr, dbr; if (auto client = static_cast(toplevel->isClient() ? toplevel : nullptr)) { client->layoutDecorationRects(dlr, dtr, drr, dbr); - } else if (auto deleted = qobject_cast(toplevel)) { + } else if (auto deleted = static_cast(toplevel->isDeleted() ? toplevel : nullptr)) { deleted->layoutDecorationRects(dlr, dtr, drr, dbr); } else { return;