From f397f072df1ed7476dc7cf907775d93575e42625 Mon Sep 17 00:00:00 2001 From: Ismael Asensio Date: Mon, 26 Oct 2020 23:27:54 +0100 Subject: [PATCH] Reply a meaningful dBus error when detecting unmanaged windows Currently, the method `createErrorReply()` with empty strings errors out and the client gets no answer: ``` QDBusConnection: error: could not send error message to service "": Error name cannot be empty ``` Simple test: qdbus org.kde.KWin /KWin org.kde.KWin.showDebugConsole qdbus org.kde.KWin /KWin org.kde.KWin.queryWindowInfo Error name uses D-Bus Interface-like notation as suggested in https://doc.qt.io/qt-5/qdbuserror.html#name CCBUG: 340477 --- dbusinterface.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dbusinterface.cpp b/dbusinterface.cpp index 3f8ae2e3f5..df681d75a6 100644 --- a/dbusinterface.cpp +++ b/dbusinterface.cpp @@ -219,7 +219,9 @@ QVariantMap DBusInterface::queryWindowInfo() if (auto c = qobject_cast(t)) { QDBusConnection::sessionBus().send(m_replyQueryWindowInfo.createReply(clientToVariantMap(c))); } else { - QDBusConnection::sessionBus().send(m_replyQueryWindowInfo.createErrorReply(QString(), QString())); + QDBusConnection::sessionBus().send(m_replyQueryWindowInfo.createErrorReply( + QStringLiteral("org.kde.KWin.Error.InvalidWindow"), + QStringLiteral("Tried to query information about an unmanaged window"))); } } );