Article View: linux.debian.bugs.dist
Article #2481Bug#1152359: okular: Host portal registration fails when desktopFileName is set after QGuiApplication is constructed
From: Andrew Atkinson
Date: Wed, 28 Oct 2026 14:10
Date: Wed, 28 Oct 2026 14:10
142 lines
7515 bytes
7515 bytes
Package: okular
Version: 4:26.08.2-1
Severity: normal
X-Debbugs-Cc: aa@wotcc.org.uk
Dear Maintainer,
*** Reporter, please consider answering these questions, where appropriate ***
* What led up to the situation?
Open okular
Then asked AI to do a check. It reported
If QGuiApplication::setDesktopFileName() is called after the QGuiApplication
object is created, registration with org.freedesktop.host.portal.Registry fails
every time and Qt prints
qt.qpa.services: Failed to register with host portal
QDBusError("org.freedesktop.portal.Error.Failed", "Could not register app ID:
Connection already associated with an application ID")
By the time Register is called, Qt has already called
org.freedesktop.portal.Settings.ReadAll (for the colour scheme and
accessibility settings) on the same D-Bus connection. xdg-desktop-portal fixes
a connection's app ID at its first portal call, so the later Register is
refused.
Setting the desktop file name after construction is common.
KAboutData::setApplicationData() does it, so every KDE application hits this.
Okular 26.08.2 (Debian 4:26.08.2-1, KF 6.30.0) shows the warning on each start,
as did 26.08.0, and CopyQ reports the same thing
(https://github.com/hluk/CopyQ/issues/3631).
Steps to reproduce:
1. Build the program below against Qt 6.11.2 (g++ main.cpp $(pkg-config
--cflags --libs Qt6Gui) -fPIC).
2. Run it with QT_LOGGING_RULES="qt.qpa.services*=true".
3. Watch the portal calls with dbus-monitor --session
"destination=org.freedesktop.portal.Desktop".
#include <QGuiApplication>
#include <QTimer>
int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
QGuiApplication::setDesktopFileName("org.kde.okular"); // any installed
desktop ID
QTimer::singleShot(1000, &app, &QGuiApplication::quit);
return app.exec();
}
Actual result:
Portal calls in this order
org.freedesktop.DBus.Properties.Get
org.freedesktop.portal.Settings.ReadAll
org.freedesktop.portal.Settings.ReadAll
org.freedesktop.host.portal.Registry.Register -> "Connection already
associated with an application ID"
Expected result:
Registration succeeds, as it does when setDesktopFileName() is called before
QGuiApplication is constructed. In that case Register comes straight after
Properties.Get and Qt logs
qt.qpa.services: Successfully registered with host portal as "org.kde.okular"
Possible fixes:
Defer the Settings portal reads until desktopFileName is known (or the event
loop starts), or register on a separate D-Bus connection. Otherwise document
that desktopFileName must be set before construction, and do not attempt a
registration that cannot succeed.
-- System Information:
Debian Release: forky/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Kernel: Linux 7.2.8+deb14-amd64 (SMP w/12 CPU threads; PREEMPT)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages okular depends on:
ii kio6 6.30.0-1+b1
ii kwallet6 6.30.0-1
ii libc6 2.43-6
ii libfreetype6 2.14.3+dfsg-2
ii libkexiv2qt6-0 26.04.0-1
ii libkf6archive6 6.30.0-1
ii libkf6bookmarks6 6.30.0-1
ii libkf6colorscheme6 6.30.0-1+b1
ii libkf6completion6 6.30.0-1
ii libkf6configcore6 6.30.0-1
ii libkf6configgui6 6.30.0-1
ii libkf6configwidgets6 6.30.0-1+b1
ii libkf6coreaddons6 6.30.0-1
ii libkf6crash6 6.30.0-1
ii libkf6i18n6 6.30.0-1
ii libkf6iconthemes6 6.30.0-1+b1
ii libkf6kiocore6 6.30.0-1+b1
ii libkf6kiogui6 6.30.0-1+b1
ii libkf6kiowidgets6 6.30.0-1+b1
ii libkf6parts6 6.30.0-1
ii libkf6purpose-bin 6.30.0-1+b1
ii libkf6purpose6 6.30.0-1+b1
ii libkf6purposewidgets6 6.30.0-1+b1
ii libkf6textwidgets6 6.30.0-1
ii libkf6wallet6 6.30.0-1
ii libkf6widgetsaddons6 6.30.0-1
ii libkf6windowsystem6 6.30.0-1+b1
ii libkf6xmlgui6 6.30.0-1+b1
ii libokular6core4 4:26.08.2-1
ii libphonon4qt6-4t64 4:4.12.0-7
ii libpoppler-qt6-3t64 26.07.0-2
ii libqmobipocket6-3 4:26.04.0-2
ii libqt6core6t64 [qt6-base-private-abi] 6.11.2+dfsg-5
ii libqt6dbus6 6.11.2+dfsg-5
ii libqt6gui6 6.11.2+dfsg-5
ii libqt6printsupport6 6.11.2+dfsg-5
ii libqt6texttospeech6 6.11.2-2
ii libqt6widgets6 6.11.2+dfsg-5
ii libqt6xml6 6.11.2+dfsg-5
ii libspectre1 0.2.12-2
ii libstdc++6 16.2.0-3
ii okular-data 4:26.08.2-1
ii phonon4qt6 4:4.12.0-7
Versions of packages okular recommends:
ii cups-bsd 2.4.18-1
ii okular-doc 4:26.08.2-1
Versions of packages okular suggests:
ii ghostscript 10.08.0~dfsg-2
pn okular-extra-backends <none>
ii poppler-data 0.4.12-1
ii texlive-binaries 2026.20260303.78225+ds-5
pn unrar <none>
-- no debconf information
Technical Details
Message-ID:
<NTcvL-8r8n-1@gated-at.bofh.it>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.corradoroberto.it!bofh.it!news.nic.it!robomodShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.corradoroberto.it!bofh.it!news.nic.it!robomod From: Andrew Atkinson <aa@wotcc.org.uk> Newsgroups: linux.debian.bugs.dist Subject: Bug#1152359: okular: Host portal registration fails when desktopFileName is set after QGuiApplication is constructed Date: Wed, 28 Oct 2026 15:10:01 +0100 Message-ID: <NTcvL-8r8n-1@gated-at.bofh.it> X-Original-To: Debian Bug Tracking System <submit@bugs.debian.org> X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org Wed Oct 28 14:03:09 2026 Old-Return-Path: <debbugs@buxtehude.debian.org> X-Spam-Flag: NO X-Spam-Score: -1.65 Reply-To: Andrew Atkinson <aa@wotcc.org.uk>, 1152359@bugs.debian.org Resent-To: debian-bugs-dist@lists.debian.org Resent-Cc: aa@wotcc.org.uk, debian-qt-kde@lists.debian.org X-Debian-Pr-Message: report 1152359 X-Debian-Pr-Package: okular X-Debian-Pr-Source: kdegraphics, okular Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Mailer: reportbug 13.2.0+nmu1 X-Debian-Message: from BTS X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/1999369 List-ID: <debian-bugs-dist.lists.debian.org> List-URL: <https://lists.debian.org/debian-bugs-dist/> Approved: robomod@news.nic.it Lines: 142 Organization: linux.* mail to news gateway Sender: robomod@news.nic.it X-Original-Date: Wed, 28 Oct 2026 14:00:55 +0000 X-Original-Message-ID: <179319605597.155696.627542798866970556.reportbug@janda>