[plasma/kwin] src: wayland_server: also update the drm device of linux_drm_syncobj_v1

Xaver Hugl <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 212915b84daaebef22e6352b16eeb0399192218d by Xaver Hugl.
Committed on 14/08/2026 at 17:34.
Pushed by zamundaaa into branch 'master'.

wayland_server: also update the drm device of linux_drm_syncobj_v1

Otherwise importing syncobj will fail after the drm device in question
was hot-unplugged.

M  +5    -0    src/wayland/linux_drm_syncobj_v1.cpp
M  +2    -1    src/wayland/linux_drm_syncobj_v1.h
M  +3    -1    src/wayland_server.cpp

https://invent.kde.org/plasma/kwin/-/commit/212915b84daaebef22e6352b16eeb0399192218d

diff --git a/src/wayland/linux_drm_syncobj_v1.cpp b/src/wayland/linux_drm_syncobj_v1.cpp
index e1bdeb4a4d6..51c403df2e9 100644
--- a/src/wayland/linux_drm_syncobj_v1.cpp
+++ b/src/wayland/linux_drm_syncobj_v1.cpp
@@ -62,6 +62,11 @@ void LinuxDrmSyncObjV1Interface::wp_linux_drm_syncobj_manager_v1_destroy(Resourc
     wl_resource_destroy(resource->handle);
 }
 
+void LinuxDrmSyncObjV1Interface::setDrmDevice(DrmDevice *drmDevice)
+{
+    m_drmDevice = drmDevice;
+}
+
 void LinuxDrmSyncObjV1Interface::remove()
 {
     QtWaylandServer::wp_linux_drm_syncobj_manager_v1::globalRemove();
diff --git a/src/wayland/linux_drm_syncobj_v1.h b/src/wayland/linux_drm_syncobj_v1.h
index 20af774e046..cbb5d8fa69e 100644
--- a/src/wayland/linux_drm_syncobj_v1.h
+++ b/src/wayland/linux_drm_syncobj_v1.h
@@ -30,6 +30,7 @@ class KWIN_EXPORT LinuxDrmSyncObjV1Interface : public QObject, private QtWayland
 public:
     explicit LinuxDrmSyncObjV1Interface(Display *display, QObject *parent, DrmDevice *drmDevice);
 
+    void setDrmDevice(DrmDevice *drmDevice);
     void remove();
 
 private:
@@ -38,7 +39,7 @@ private:
     void wp_linux_drm_syncobj_manager_v1_destroy(Resource *resource) override;
     void wp_linux_drm_syncobj_manager_v1_destroy_global() override;
 
-    DrmDevice *const m_drmDevice;
+    DrmDevice *m_drmDevice;
 };
 
 class LinuxDrmSyncObjSurfaceV1 : private QtWaylandServer::wp_linux_drm_syncobj_surface_v1
diff --git a/src/wayland_server.cpp b/src/wayland_server.cpp
index dd92238c68a..910ef28fe8f 100644
--- a/src/wayland_server.cpp
+++ b/src/wayland_server.cpp
@@ -840,7 +840,9 @@ void WaylandServer::updateSyncobjSupport()
         if (linuxVersion.majorVersion() == 6 && (linuxVersion.minorVersion() == 7 || (linuxVersion.minorVersion() == 6 && linuxVersion.patchVersion() < 19))) {
             return;
         }
-        if (!m_linuxDrmSyncObj) {
+        if (m_linuxDrmSyncObj) {
+            m_linuxDrmSyncObj->setDrmDevice((*it)->drmDevice());
+        } else {
             m_linuxDrmSyncObj = new LinuxDrmSyncObjV1Interface(m_display, m_display, (*it)->drmDevice());
         }
     } else if (m_linuxDrmSyncObj) {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.