git: 4b46b47d31da - main - x11/plasma6-layer-shell-qt: Fix crash when right-clicking the desktop

From: Gleb Popov <arrowd_at_FreeBSD.org>
Date: Sat, 26 Jul 2025 18:23:11 UTC
The branch main has been updated by arrowd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=4b46b47d31da8d6b6d87bd27903b2d8056a53b22

commit 4b46b47d31da8d6b6d87bd27903b2d8056a53b22
Author:     Gleb Popov <arrowd@FreeBSD.org>
AuthorDate: 2025-07-25 10:40:42 +0000
Commit:     Gleb Popov <arrowd@FreeBSD.org>
CommitDate: 2025-07-26 18:22:52 +0000

    x11/plasma6-layer-shell-qt: Fix crash when right-clicking the desktop
    
    Tested by:      makc, Kenneth Raplee <kenrap@kennethraplee.com>
    Pull Request:   https://github.com/freebsd/freebsd-ports/pull/431
---
 x11/plasma6-layer-shell-qt/Makefile                     |  1 +
 .../files/patch-src_qwaylandlayersurface.cpp            | 17 +++++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/x11/plasma6-layer-shell-qt/Makefile b/x11/plasma6-layer-shell-qt/Makefile
index 7d07e029f098..30f4a19b164f 100644
--- a/x11/plasma6-layer-shell-qt/Makefile
+++ b/x11/plasma6-layer-shell-qt/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	layer-shell-qt
 DISTVERSION=	${KDE_PLASMA_VERSION}
+PORTREVISION=	1
 CATEGORIES=	x11 kde kde-plasma
 
 COMMENT=	Qt component to allow applications to make use of the Wayland wl-layer-shell protocol
diff --git a/x11/plasma6-layer-shell-qt/files/patch-src_qwaylandlayersurface.cpp b/x11/plasma6-layer-shell-qt/files/patch-src_qwaylandlayersurface.cpp
new file mode 100644
index 000000000000..264ac398bdcd
--- /dev/null
+++ b/x11/plasma6-layer-shell-qt/files/patch-src_qwaylandlayersurface.cpp
@@ -0,0 +1,17 @@
+Fix the crash that happens when right-clicking the desktop surface
+
+--- src/qwaylandlayersurface.cpp.orig	2025-07-15 09:53:41 UTC
++++ src/qwaylandlayersurface.cpp
+@@ -113,10 +113,8 @@ void QWaylandLayerSurface::attachPopup(QtWaylandClient
+ 
+ void QWaylandLayerSurface::attachPopup(QtWaylandClient::QWaylandShellSurface *popup)
+ {
+-    std::any anyRole = popup->surfaceRole();
+-
+-    if (auto role = std::any_cast<::xdg_popup *>(&anyRole)) {
+-        get_popup(*role);
++    if (auto role = popup->nativeResource("xdg_popup")) {
++        get_popup(reinterpret_cast<struct ::xdg_popup*>(role));
+     } else {
+         qCWarning(LAYERSHELLQT) << "Cannot attach popup of unknown type";
+     }