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
This commit is contained in:
Vlad Zahorodnii 2020-10-12 19:51:51 +03:00
parent 489fc93fcf
commit 780dba4966

View file

@ -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)