From 780dba4966f7d290d1ab2320da28f427ce212731 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 12 Oct 2020 19:51:51 +0300 Subject: [PATCH] Properly handle destruction of XdgOutputV1Interface The xdg-output spec omits whether the compositor has to destroy all xdg- output resources when the associated wl_output global is removed. This means that no xdg-output resource should be destroyed unless the client has called the destructor request; otherwise the client may panic due to protocol errors. Starting with Qt 5.15.2, it's okay to destroy generated wrapper objects without destroying associated resources. Destructor requests will be handled behind the scenes for inert and orphaned resources by code that is generated by qtwaylandscanner. BUG: 426293 --- src/wayland/xdgoutput_v1_interface.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/wayland/xdgoutput_v1_interface.cpp b/src/wayland/xdgoutput_v1_interface.cpp index 0eee238b92..5f9e1f06ce 100644 --- a/src/wayland/xdgoutput_v1_interface.cpp +++ b/src/wayland/xdgoutput_v1_interface.cpp @@ -108,6 +108,9 @@ XdgOutputV1Interface::XdgOutputV1Interface(QObject *parent) XdgOutputV1Interface::~XdgOutputV1Interface() { +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 2) + // Starting from 5.15.2, qtwaylandscanner properly handles destruction of inert/orphaned resources. + // Generated code typically cleans up resource objects when the client calls the relevant destructor // In multi-cast mode our wrapper can be deleted at any time whilst a client resource exists. // any existing resources that have a pending message will then crash the compositor. @@ -118,7 +121,7 @@ XdgOutputV1Interface::~XdgOutputV1Interface() { wl_resource_destroy(resource->handle); } - +#endif } void XdgOutputV1Interface::setLogicalSize(const QSize &size)