[plasma/kwin/Plasma/6.7] src/wayland: wayland: use QPointer for the xdg_popup parent surface
Vlad Zahorodnii <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 0de99deddbaef66cbc1fa887d8b3bebc5aa55908 by Vlad Zahorodnii. Committed on 10/08/2026 at 10:32. Pushed by vladz into branch 'Plasma/6.7'. wayland: use QPointer for the xdg_popup parent surface This is a defensive fix. parentSurface was a raw pointer that was never cleared. Normally the popup is destroyed before its parent surface, but an abnormal or malicious client can destroy the parent wl_surface first and then send xdg_popup.reposition, which would dereference the freed pointer. Use a QPointer so the pointer is automatically nulled when the parent surface is destroyed. (cherry picked from commit 72e9cb50465971bda64ee39d06aa18e8cedaf0d5) Co-authored-by: zhang shoucheng <[email protected]> M +2 -1 src/wayland/xdgshell_p.h https://invent.kde.org/plasma/kwin/-/commit/0de99deddbaef66cbc1fa887d8b3bebc5aa55908 diff --git a/src/wayland/xdgshell_p.h b/src/wayland/xdgshell_p.h index 38e82eb23ed..40113cfcf82 100644 --- a/src/wayland/xdgshell_p.h +++ b/src/wayland/xdgshell_p.h @@ -7,6 +7,7 @@ #pragma once #include <QIcon> +#include <QPointer> #include "qwayland-server-xdg-shell.h" #include "xdgshell.h" @@ -193,7 +194,7 @@ public: void reset(); XdgPopupInterface *q; - SurfaceInterface *parentSurface = nullptr; + QPointer<SurfaceInterface> parentSurface; XdgSurfaceInterface *xdgSurface; XdgPositioner positioner;