Bug 463931 - "Show Target" action for symbolic links often opens multiple new windows
Summary: "Show Target" action for symbolic links often opens multiple new windows
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-06 15:55 UTC by Paul Worrall
Modified: 2023-02-18 04:07 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.104
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Worrall 2023-01-06 15:55:33 UTC
STEPS TO REPRODUCE
1.  Create a symbolic link to a file in a different folder
2.  Right-Click on the link => Show Target

OBSERVED RESULT
Not always, but quite often there is a short delay followed by multiple (usually two but can be many more) new Dolphin windows opened with the target of the symbolic link selected.

EXPECTED RESULT
Only open one new window with the target selected

SOFTWARE/OS VERSIONS
Dolphin Version: 23.03.70
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.26.80
KDE Frameworks Version: 5.102.0
Qt Version: 5.15.7
Graphics Platform: Wayland
Processors: 2 × AMD A6-6400K APU with Radeon(tm) HD Graphics
Memory: 7.7 GiB of RAM
Comment 1 Bug Janitor Service 2023-02-16 05:47:58 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/1202
Comment 2 Jin Liu 2023-02-16 06:17:41 UTC
BTW, before it's fixed, you can use this workaround.
1. Open a Dolphin window and put it aside. Don't use it.
2. Open another Dolphin window. "Show Target" will work fine in this new window
(and all new windows, as long as the 1st window is there.)
Comment 3 Bug Janitor Service 2023-02-16 12:42:08 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/1203
Comment 4 Nicolas Fella 2023-02-17 12:55:14 UTC
Git commit 71c0763c15fa35ea74aef3d1f89ba112af284bd6 by Nicolas Fella, on behalf of Jin Liu.
Committed on 17/02/2023 at 12:55.
Pushed by nicolasfella into branch 'master'.

OpenFileManagerWindowJob: fix opening multiple instances under Wayland

The Problem:
Under wayland, when there's only one Dolphin window, "Show Target" in
Dolphin's right click menu opens multiple duplicate Dolphin windows.

The Cause:
DolphinMainWindow::showTarget
=> KIO::OpenFileManagerWindowJob::highlightInFileManager
=> KWindowSystem::requestXdgActivationToken
=> on KWindowSystem::xdgActivationTokenArrived signal
=> dbus call org.freedesktop.FileManager1 ShowItems
=> Dolphin::DBusInterface::ShowItems
=> Dolphin::openNewWindow
=> KIO::ApplicationLauncherJob
=> KIO::KProcessRunner
=> Calls KWindowSystem::requestXdgActivationToken under Wayland. Loop.

The Fix:
Pass Qt::SingleShotConnection flag to QObject::connect() to avoid the
loop.

M  +1    -1    src/widgets/openfilemanagerwindowjob.cpp

https://invent.kde.org/frameworks/kio/commit/71c0763c15fa35ea74aef3d1f89ba112af284bd6
Comment 5 Nicolas Fella 2023-02-17 14:44:38 UTC
Git commit e8a7a6c83e8725a73cb4c90b572315594a58f65c by Nicolas Fella, on behalf of Jin Liu.
Committed on 17/02/2023 at 12:55.
Pushed by nicolasfella into branch 'kf5'.

OpenFileManagerWindowJob: fix opening multiple instances under Wayland [KF5]

The Problem:
Under wayland, when there's only one Dolphin window, "Show Target" in
Dolphin's right click menu opens multiple duplicate Dolphin windows.

The Cause:
DolphinMainWindow::showTarget
=> KIO::OpenFileManagerWindowJob::highlightInFileManager
=> KWindowSystem::requestXdgActivationToken
=> on KWindowSystem::xdgActivationTokenArrived signal
=> dbus call org.freedesktop.FileManager1 ShowItems
=> Dolphin::DBusInterface::ShowItems
=> Dolphin::openNewWindow
=> KIO::ApplicationLauncherJob
=> KIO::KProcessRunner
=> Calls KWindowSystem::requestXdgActivationToken under Wayland. Loop.

The Fix:
Call QObject::disconnect() first in the slot to disconnect the signal.

M  +1    -0    src/widgets/openfilemanagerwindowjob.cpp

https://invent.kde.org/frameworks/kio/commit/e8a7a6c83e8725a73cb4c90b572315594a58f65c