Bug 488515 - Plasmashell exits with Wayland protocol error ("xdg_popup parent surface has been specified") when I drag and drop an icon from the application launcher to the desktop on Wayland
Summary: Plasmashell exits with Wayland protocol error ("xdg_popup parent surface has ...
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: generic-crash (show other bugs)
Version: 6.1.0
Platform: Arch Linux Linux
: NOR crash
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: qt6, wayland
Depends on:
Blocks:
 
Reported: 2024-06-15 06:02 UTC by Petar Nedyalkov
Modified: 2024-06-27 19:20 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.2.0


Attachments
Video (1.24 MB, video/webm)
2024-06-15 06:02 UTC, Petar Nedyalkov
Details
Video 2 (1.06 MB, video/webm)
2024-06-18 05:17 UTC, Petar Nedyalkov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Petar Nedyalkov 2024-06-15 06:02:55 UTC
Created attachment 170511 [details]
Video

SUMMARY
Plasmashell crashes when I drag and drop an icon from the application launcher to the desktop on Wayland. It cannot be reproduced on Plasma 6.0.4 or X11 session

STEPS TO REPRODUCE
1. Open the application launcher
2. Search an application (e.g. Konsole)
3. Drag and drop an application from the application launcher to the desktop
4. Observe.

OBSERVED RESULT
Plasmashell crashes when I drag and drop an icon from the application launcher to the desktop on Wayland. I've observed the following error in the Konsole:

Received a suitable dropEvent at  QPoint(177,415)
Bailing out. Cannot find associated dropEvent related to the TransferJob
Creating menu for:  "application/x-desktop"
KPackageStructure of KPluginMetaData(pluginId:"zayron.simple.separator", fileName: "/home/pnedyalkov/.local/share/plasma/plasmoids/zayron.simple.separator/metadata.json") does not match requested format "Plasma/Applet"
xdg_wm_base#3: error 3: no xdg_popup parent surface has been specified
The Wayland connection experienced a fatal error: Protocol error


EXPECTED RESULT
The drag and drop function is working without causing plasmashell crashes. The dropped icon is located on the desktop.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.0.90
KDE Frameworks Version: 6.3.0
Qt Version: 6.8.0
Kernel Version: 6.9.4-arch1-1 (64-bit)
Graphics Platform: Wayland
Graphics Processor: NVIDIA GeForce RTX 2060/PCIe/SSE2

ADDITIONAL INFORMATION
Video is attached for reference.
Comment 1 Nate Graham 2024-06-17 17:28:39 UTC
Cannot reproduce. The logging shows that yo have a broken widget somewhere:

> KPackageStructure of KPluginMetaData(pluginId:"zayron.simple.separator", fileName:
> "/home/pnedyalkov/.local/share/plasma/plasmoids/zayron.simple.separator/metadata.json")
> does not match requested format "Plasma/Applet"
I wonder if this is related; if you remove that widget and then restart the machine, does the issue still happen?

Obviously if this fixes it, we have a different bug; a broken widget shouldn't cause this issue. But it would be good to know if that's related or not.
Comment 2 Petar Nedyalkov 2024-06-18 05:17:43 UTC
Created attachment 170589 [details]
Video 2
Comment 3 Petar Nedyalkov 2024-06-18 05:19:17 UTC
Hello Nate,

Thank you for your feedback. I removed and uninstalled the widget, but the issue is still reproducible. I recorded a new video and can be found in the above comment. The Plasmashell exits with the following Wayland protocol error:

qt.qml.context: file:///usr/share/plasma/plasmoids/org.kde.plasma.kickoff/contents/ui/KickoffDropArea.qml:19:5 Parameter "drag" is not declared. Injection of parameters into signal handlers is deprecated. Use JavaScript functions with formal parameters instead.
file:///usr/share/plasma/plasmoids/org.kde.plasma.kickoff/contents/ui/KickoffGridView.qml:147:19: QML KickoffGridDelegate (parent or ancestor of QQuickDragAttached): Binding loop detected for property "active"
Arrived mimeData QList(QUrl("file:///usr/share/applications/systemsettings.desktop")) QList("text/uri-list") at 788 ,  753
Mimetype Job returns. "application/x-desktop"
Received a suitable dropEvent at  QPoint(788,753)
Bailing out. Cannot find associated dropEvent related to the TransferJob
Creating menu for:  "application/x-desktop"
xdg_wm_base#3: error 3: no xdg_popup parent surface has been specified
The Wayland connection experienced a fatal error: Protocol error
Comment 4 Nate Graham 2024-06-19 18:36:00 UTC
Fascinating. Yeah, I can't reproduce that with git master everything. I wonder if this is caused by an old version of plasma-wayland-protocols, maybe? What version of that package (might be under a slight different name) do you have?
Comment 5 Nate Graham 2024-06-19 19:04:41 UTC
I talked to a KWin developer and he said it's likely a Qt issue. I see you're using 6.8, while I've got 6.7.1 myself (and it works for me), so this seems possible.
Comment 6 Petar Nedyalkov 2024-06-20 05:49:30 UTC
Hello Nate. Thank you for your feedback. I updated Plasma to 6.1 stable on my Arch Linux but the issue still persists. I have installed the Wayland protocols packages listed below:
plasma-wayland-protocols - 1.13.0-1
wayland-protocols- 1.36-1

Unfortunately, I cannot downgrade Qt to 5.7.x on Arch Linux. Here is my updated configuration:
Operating System: Arch Linux 
KDE Plasma Version: 6.1.0
KDE Frameworks Version: 6.3.0
Qt Version: 6.8.0
Kernel Version: 6.9.5-arch1-1 (64-bit)
Graphics Platform: Wayland
Comment 7 Bug Janitor Service 2024-06-20 09:05:38 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/1650
Comment 8 Bug Janitor Service 2024-06-20 09:05:52 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/libplasma/-/merge_requests/1151
Comment 9 Vlad Zahorodnii 2024-06-20 09:10:00 UTC
qtwayland patch: https://codereview.qt-project.org/c/qt/qtwayland/+/570201
Comment 10 Vlad Zahorodnii 2024-06-24 16:54:48 UTC
Git commit d3ffa52bf2deb487ce9761551c08b6905a5dffb1 by Vlad Zahorodnii.
Committed on 24/06/2024 at 16:50.
Pushed by vladz into branch 'master'.

kjobwidgets: Force setWindow() creating a window handle

Otherwise a null window handle may be set.

M  +9    -1    src/kjobwidgets.cpp

https://invent.kde.org/frameworks/kwidgetsaddons/-/commit/d3ffa52bf2deb487ce9761551c08b6905a5dffb1
Comment 11 Vlad Zahorodnii 2024-06-24 16:54:56 UTC
Git commit cccaa8f89897146043a535d45a276e3a57412815 by Vlad Zahorodnii.
Committed on 24/06/2024 at 16:50.
Pushed by vladz into branch 'master'.

kjobwidgets: Add functions to associate QWindow with a KJob

KJobWidgets::setWindow() only works with QWidget objects. But there are
cases where a QtQuick based component needs to associate a QWindow with
a KJob in order to set a proper trasient parent for popups, etc.

M  +9    -1    src/kjobwidgets.cpp
M  +22   -1    src/kjobwidgets.h

https://invent.kde.org/frameworks/kwidgetsaddons/-/commit/cccaa8f89897146043a535d45a276e3a57412815
Comment 12 Vlad Zahorodnii 2024-06-24 17:31:23 UTC
Git commit b6de43287519ecc2e9fdaa160e5a5b2f33ef9a31 by Vlad Zahorodnii.
Committed on 24/06/2024 at 16:55.
Pushed by vladz into branch 'master'.

Port DropJob to KJobWidgets::windowHandle()

This allows QtQuick components setting transient parent for DropJobs.

M  +11   -0    src/widgets/dropjob.cpp

https://invent.kde.org/frameworks/kio/-/commit/b6de43287519ecc2e9fdaa160e5a5b2f33ef9a31
Comment 13 Vlad Zahorodnii 2024-06-25 14:17:52 UTC
Git commit 1120130cfedaa3770b5009a4bbf13d94c84d12b2 by Vlad Zahorodnii.
Committed on 25/06/2024 at 14:16.
Pushed by vladz into branch 'master'.

Specify transient parent both for drop menu and drop job

Currently, the transient parent for the drop job popup is unset, so
QtWayland QPA needs to guess the transient parent, otherwise the
client would be killed due to violating the xdg-shell protocol.

The popup parent heuristics in QtWayland are based on input events,
specifically they check what window the user interacted with last
time, i.e. where the last pointer button click has occurred, etc.

When dragging something, the last interacted window will correspond
to the drag source, so if a popup needs to be shown, it will likely
have the drag source window as the transient parent. This can be a
problem. For example, when dragging an item from Kickoff to the
desktop, Kickoff window will close when a drop occurs on the desktop.

QtWayland can't work around that. It simply needs to be told proper
metadata about the connection of the popup to the parent window. The
purpose of the setTransientParent() function is to achieve exactly
that.

M  +11   -3    src/plasmaquick/plasmoid/dropmenu.cpp

https://invent.kde.org/plasma/libplasma/-/commit/1120130cfedaa3770b5009a4bbf13d94c84d12b2