Remove a Workspace::findAbstractClient() overload

Workspace::findAbstractClient(QUuid) overload is used only by the
windows krunner plugin.

This change fixes a potential null dereferencing and removes the
findAbstractClient() overload in favor of a more generic findToplevel()
overload.
This commit is contained in:
Vlad Zahorodnii 2022-05-07 10:38:11 +03:00
parent 9ef882f3fb
commit 51e9340abb
3 changed files with 5 additions and 9 deletions

View file

@ -218,8 +218,11 @@ void WindowsRunner::Run(const QString &id, const QString &actionId)
return;
}
const auto uuid = QUuid::fromString(objectId);
const auto window = workspace()->findAbstractClient(uuid);
const auto window = workspace()->findToplevel(QUuid::fromString(objectId));
if (!window || !window->isClient()) {
return;
}
switch (action) {
case ActivateAction:
workspace()->activateWindow(window);

View file

@ -1790,12 +1790,6 @@ Window *Workspace::findAbstractClient(std::function<bool(const Window *)> func)
return nullptr;
}
Window *Workspace::findAbstractClient(const QUuid &internalId) const
{
auto t = findToplevel(internalId);
return t && t->isClient() ? t : nullptr;
}
Unmanaged *Workspace::findUnmanaged(std::function<bool(const Unmanaged *)> func) const
{
return Window::findInList(m_unmanaged, func);

View file

@ -103,7 +103,6 @@ public:
*/
X11Window *findClient(std::function<bool(const X11Window *)> func) const;
Window *findAbstractClient(std::function<bool(const Window *)> func) const;
Window *findAbstractClient(const QUuid &internalId) const;
/**
* @brief Finds the Client matching the given match @p predicate for the given window.
*