Bug 479397 - krunner appstream plugin does not launch Discover
Summary: krunner appstream plugin does not launch Discover
Status: RESOLVED FIXED
Alias: None
Product: krunner
Classification: Plasma
Component: general (show other bugs)
Version: 5.91.0
Platform: Fedora RPMs Linux
: NOR major
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords: qt6, wayland
Depends on:
Blocks:
 
Reported: 2024-01-04 15:56 UTC by Alessandro Astone
Modified: 2024-03-05 17:11 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alessandro Astone 2024-01-04 15:56:30 UTC
The krunner appstream plugin correctly gives matches, but clicking them does nothing.
My custom logging shows that it reaches QDesktopServices::openUrl() and that it returns success, yet nothing happens.

STEPS TO REPRODUCE
1. Search Chromium
2. Click "Get Chromium Web Browser..."

OBSERVED RESULT
Nothing

EXPECTED RESULT
Discover starts and shows the application page

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Fedora Rawhide KDE
(available in About System)
KDE Plasma Version: 5.91.0
KDE Frameworks Version: 5.247.0
Qt Version: 6.6.1

ADDITIONAL INFORMATION
`xdg-open appstream://foo` works
Writing a minimal QtGuiApplication that calls `QDesktopServices::openUrl(QUrl("appstream://foo"))` works
Comment 1 Nate Graham 2024-01-11 20:49:20 UTC

*** This bug has been marked as a duplicate of bug 472300 ***
Comment 2 Alessandro Astone 2024-01-11 20:51:22 UTC
Not the same bug; see ADDITIONAL INFORMATION

But i presume you cannot reproduce?
Comment 3 Nate Graham 2024-01-12 21:50:24 UTC
Ah, I missed that part, sorry.

I can reproduce the issue; I was simply assuming it was another manifestation of https://gitlab.freedesktop.org/xdg/xdg-utils/-/merge_requests/67.
Comment 4 Nicolas Fella 2024-01-13 22:00:39 UTC
I know what's going on.

QGenericUnixServices::openUrl requests an xdg-activation token before it calls xdg-open.

In the time between the token being requested and arriving the kickoff/krunner window closes and the Qt window object is destroyed. This causes the connect in https://invent.kde.org/qt/qt/qtbase/-/blob/dev/src/gui/platform/unix/qgenericunixservices.cpp#L439 to disconnect and the slot (that ends up calling xdg-open) is never called.

I'm fairly sure this worked at some point, and the relevant code didn't really change, so not sure what triggers it
Comment 5 Bug Janitor Service 2024-01-24 21:34:41 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/3822
Comment 6 Alexander Lohnau 2024-01-25 05:45:39 UTC
Git commit 64ae1699f6b4b55cbbc3e71b8d3b42a56582dbb8 by Alexander Lohnau, on behalf of Nicolas Fella.
Committed on 25/01/2024 at 06:45.
Pushed by alex into branch 'master'.

[runners/appstream] Use KIO::OpenUrlJob instead of QDesktopServices::openUrl

M  +1    -1    runners/appstream/CMakeLists.txt
M  +6    -2    runners/appstream/appstreamrunner.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/64ae1699f6b4b55cbbc3e71b8d3b42a56582dbb8
Comment 7 Alexander Lohnau 2024-01-25 17:19:13 UTC
Git commit b9be19c007edc20716fcc8ab2c6bc453be566a29 by Alexander Lohnau, on behalf of Nicolas Fella.
Committed on 25/01/2024 at 18:19.
Pushed by alex into branch 'Plasma/6.0'.

[runners/appstream] Use KIO::OpenUrlJob instead of QDesktopServices::openUrl


(cherry picked from commit 64ae1699f6b4b55cbbc3e71b8d3b42a56582dbb8)

M  +1    -1    runners/appstream/CMakeLists.txt
M  +6    -2    runners/appstream/appstreamrunner.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/b9be19c007edc20716fcc8ab2c6bc453be566a29