From 46a5aa63a1906f4b01f81f1a806ca61d4052666a Mon Sep 17 00:00:00 2001 From: "Tobias J. Endres" Date: Thu, 14 Aug 2025 07:15:06 +0200 Subject: [PATCH] Fix: QDBusMessage::clearArguments() method not found\n\nRemoved the call to clearArguments() as it was causing a compilation error due to its removal in Qt 5.15. Updated lessons_learned.md. --- lessons_learned.md | 5 +++++ wayland_poc.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lessons_learned.md b/lessons_learned.md index 04e2581..ec615b2 100644 --- a/lessons_learned.md +++ b/lessons_learned.md @@ -98,6 +98,11 @@ This document summarizes the key challenges, debugging steps, and solutions enco 1. Created a new handler function, `handleCreateSessionFinished`, to specifically process the `CreateSession` reply. This function extracts the session handle and then correctly initiates the `SelectSources` D-Bus call with its own `QDBusPendingCallWatcher` connected to `handleSelectSourcesResponse`. 2. Modified the `main` function to connect the `CreateSession`'s `QDBusPendingCallWatcher` to `handleCreateSessionFinished`. +* **`QDBusMessage::clearArguments()` Method Not Found:** + * **Problem:** Compilation failed with an error indicating `QDBusMessage` had no member named `clearArguments()`. + * **Diagnosis:** The `clearArguments()` method was removed in Qt 5.15, which is the version likely used in the Docker build environment. The call was also redundant as arguments were being cleared and then immediately re-added. + * **Fix:** Removed the line `message.clearArguments();` from `wayland_poc.cpp`. + * **New Runtime Error: "Remote peer disconnected"** * **Problem:** After successfully building and copying `wayland_poc` to the host, running it resulted in "D-Bus call to SelectSources failed: "Remote peer disconnected"". * **Diagnosis:** This indicates a problem with the D-Bus connection itself, rather than a rejection from the portal. Possible causes include incorrect D-Bus environment variables on the host, `xdg-desktop-portal` not running, or permission issues. diff --git a/wayland_poc.cpp b/wayland_poc.cpp index 5cdaccb..cb06a72 100644 --- a/wayland_poc.cpp +++ b/wayland_poc.cpp @@ -105,7 +105,7 @@ void handleCreateSessionFinished(QDBusPendingCallWatcher *watcher) { options.insert("handle_token", QUuid::createUuid().toString(QUuid::WithoutBraces)); // Use QUuid without braces options.insert("restore_token", QUuid::createUuid().toString(QUuid::WithoutBraces)); // Add restore_token (OBS value) - message.clearArguments(); // Clear any existing arguments + message << options; QDBusPendingCall pendingCall = sessionBus.asyncCall(message);