https://bugs.kde.org/show_bug.cgi?id=522372

[email protected] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #1 from [email protected] ---
Disclosure: Partially generated by AI, AI generated parts are marked below.

I have ghostty installed with the context menu entry "Open Ghostty Here"
enabled. Occasionally when clicking that option terminal would open to home
directory (instead of the current directory). I used Claude to do the
following:

- Get a concrete reproduction of the bug by first selecting a file after
navigating to a directory, then clicking on a blank space and choosing "Open
Ghostty Here" - this always opened to home directory
- Fix the issue locally by adding a flush - this fixed the issue and always
opens the terminal in current directory

Not including the code since I do not know if it's the correct quality, and
also since AI contributions are not encouraged.

------------- Below details generated by AI ----------------

Environment: dolphin 26.04.3, kio 6.27.0, CachyOS (Arch-based), Plasma Wayland.
Service menu: Exec=ghostty --working-directory=%F --gtk-single-instance=false
(MimeType=inode/directory).
Here the symptom is the terminal opening in $HOME: the embedded %F expands to
an
empty string. With a standalone %f (comment 0) the argument is dropped
entirely,
hence argc=0 - same root cause, different Exec shape.

Root cause - a stale-selection race, not a directory-listing race:

1. DolphinView compresses selectionChanged notifications through
   m_selectionChangedTimer (src/views/dolphinview.cpp, single-shot, interval 0
or
   300 ms depending on whether the selection state toggled).
2. Right-clicking the view background while a selection exists clears the
   selection on press and arms that timer.
3. slotItemContextMenuRequested() flushes the pending signal before requesting
the
   context menu (added for bug 294013) - but slotViewContextMenuRequested()
does
   NOT have that flush.
4. The viewport menu is built with correct KFileItemListProperties
   (DolphinContextMenu::addViewportContextMenu() -> baseFileItem()), but once
the
   QMenu event loop runs, the pending timer fires and
   DolphinMainWindow::slotSelectionChanged() (dolphinmainwindow.cpp:441)
   overwrites the shared KFileItemActions' item-list properties with the
   now-empty selection.
5. KFileItemActionsPrivate::slotExecuteService() reads m_props.urlList() at
click
   time -> zero URLs -> KIO::ApplicationLauncherJob with no URLs ->
   DesktopExecParser expands %f/%F/%u/%U to nothing.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to