Package: okular
Version: 4:26.08.2-1
Severity: normal
X-Debbugs-Cc: [email protected]
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