summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Redondo <qt@david-redondo.de>2023-06-13 14:02:59 +0200
committerDavid Redondo <qt@david-redondo.de>2024-01-17 09:06:19 +0100
commit5085fa08226ff58543359ccf4e6cc34176d7d252 (patch)
tree6f68de080e49d5fb573e9912ac71779bf658552e
parentf803f80c3e18d14946d8c46137211c3a710c3036 (diff)
Make sure wayland object destructors are called
Always at least call the generated "interface"_destroy method which does destroy the proxy. For not already wrapped classes a small template is introduced to pass a function that is called in the destructor. Fixes: QTBUG-111576 Change-Id: I373463710764958ddea42ef0f7dc010c427b2ce8 Reviewed-by: David Edmundson <davidedmundson@kde.org> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
-rw-r--r--src/client/qwaylanddatadevice.cpp2
-rw-r--r--src/client/qwaylanddisplay.cpp62
-rw-r--r--src/client/qwaylanddisplay_p.h15
-rw-r--r--src/client/qwaylandinputdevice.cpp9
-rw-r--r--src/client/qwaylandinputmethodcontext.cpp1
-rw-r--r--src/client/qwaylandnativeinterface.cpp16
-rw-r--r--src/client/qwaylandpointergestures.cpp8
-rw-r--r--src/client/qwaylandpointergestures_p.h1
-rw-r--r--src/client/qwaylandprimaryselectionv1.cpp5
-rw-r--r--src/client/qwaylandprimaryselectionv1_p.h1
-rw-r--r--src/client/qwaylandqtkey.cpp5
-rw-r--r--src/client/qwaylandqtkey_p.h1
-rw-r--r--src/client/qwaylandscreen.cpp9
-rw-r--r--src/client/qwaylandscreen_p.h1
-rw-r--r--src/client/qwaylandshm.cpp2
-rw-r--r--src/client/qwaylandtabletv2.cpp5
-rw-r--r--src/client/qwaylandtabletv2_p.h1
-rw-r--r--src/client/qwaylandtextinputv1.cpp1
-rw-r--r--src/client/qwaylandtouch.cpp5
-rw-r--r--src/client/qwaylandtouch_p.h1
-rw-r--r--src/client/qwaylandwindowmanagerintegration.cpp4
-rw-r--r--src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp6
-rw-r--r--src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h1
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp4
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h1
25 files changed, 133 insertions, 34 deletions
diff --git a/src/client/qwaylanddatadevice.cpp b/src/client/qwaylanddatadevice.cpp
index 3344d3806..dd5e62cd0 100644
--- a/src/client/qwaylanddatadevice.cpp
+++ b/src/client/qwaylanddatadevice.cpp
@@ -43,6 +43,8 @@ QWaylandDataDevice::~QWaylandDataDevice()
{
if (version() >= WL_DATA_DEVICE_RELEASE_SINCE_VERSION)
release();
+ else
+ wl_data_device_destroy(object());
}
QWaylandDataOffer *QWaylandDataDevice::selectionOffer() const
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp
index 0c73fdc37..890fed199 100644
--- a/src/client/qwaylanddisplay.cpp
+++ b/src/client/qwaylanddisplay.cpp
@@ -260,14 +260,14 @@ Q_LOGGING_CATEGORY(lcQpaWayland, "qt.qpa.wayland"); // for general (uncategorize
struct wl_surface *QWaylandDisplay::createSurface(void *handle)
{
- struct wl_surface *surface = mCompositor.create_surface();
+ struct wl_surface *surface = mGlobals.compositor->create_surface();
wl_surface_set_user_data(surface, handle);
return surface;
}
struct ::wl_region *QWaylandDisplay::createRegion(const QRegion &qregion)
{
- struct ::wl_region *region = mCompositor.create_region();
+ struct ::wl_region *region = mGlobals.compositor->create_region();
for (const QRect &rect : qregion)
wl_region_add(region, rect.x(), rect.y(), rect.width(), rect.height());
@@ -371,8 +371,12 @@ QWaylandDisplay::~QWaylandDisplay(void)
if (m_frameEventQueue)
wl_event_queue_destroy(m_frameEventQueue);
+ // Reset the globals manually since they need to be destroyed before the wl_display
mGlobals = {};
+ if (object())
+ wl_registry_destroy(object());
+
if (mDisplay)
wl_display_disconnect(mDisplay);
}
@@ -425,8 +429,6 @@ void QWaylandDisplay::reconnect()
QWindowSystemInterface::handleScreenRemoved(screen);
}
- // mCompositor
- mShm.reset();
mCursorThemes.clear();
mCursor.reset();
@@ -602,6 +604,16 @@ void QWaylandDisplay::handleScreenInitialized(QWaylandScreen *screen)
}
}
+template <typename T, auto f>
+struct WithDestructor : public T
+{
+ using T::T;
+ ~WithDestructor()
+ {
+ f(this->object());
+ }
+};
+
void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uint32_t version)
{
struct ::wl_registry *registry = object();
@@ -614,9 +626,11 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
if (interface == QLatin1String(QtWayland::wl_output::interface()->name)) {
mWaitingScreens << mWaylandIntegration->createPlatformScreen(this, version, id);
} else if (interface == QLatin1String(QtWayland::wl_compositor::interface()->name)) {
- mCompositor.init(registry, id, qMin((int)version, 6));
+ mGlobals.compositor.reset(
+ new WithDestructor<QtWayland::wl_compositor, wl_compositor_destroy>(
+ registry, id, qMin((int)version, 6)));
} else if (interface == QLatin1String(QWaylandShm::interface()->name)) {
- mShm.reset(new QWaylandShm(this, version, id));
+ mGlobals.shm.reset(new QWaylandShm(this, version, id));
} else if (interface == QLatin1String(QWaylandInputDevice::interface()->name)) {
QWaylandInputDevice *inputDevice = mWaylandIntegration->createInputDevice(this, version, id);
mInputDevices.append(inputDevice);
@@ -625,9 +639,13 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
mGlobals.dndSelectionHandler.reset(new QWaylandDataDeviceManager(this, version, id));
#endif
} else if (interface == QLatin1String(QtWayland::qt_surface_extension::interface()->name)) {
- mGlobals.surfaceExtension.reset(new QtWayland::qt_surface_extension(registry, id, 1));
+ mGlobals.surfaceExtension.reset(
+ new WithDestructor<QtWayland::qt_surface_extension, qt_surface_extension_destroy>(
+ registry, id, 1));
} else if (interface == QLatin1String(QtWayland::wl_subcompositor::interface()->name)) {
- mGlobals.subCompositor.reset(new QtWayland::wl_subcompositor(registry, id, 1));
+ mGlobals.subCompositor.reset(
+ new WithDestructor<QtWayland::wl_subcompositor, wl_subcompositor_destroy>(registry,
+ id, 1));
} else if (interface == QLatin1String(QWaylandTouchExtension::interface()->name)) {
mGlobals.touchExtension.reset(new QWaylandTouchExtension(this, id));
} else if (interface == QLatin1String(QWaylandQtKeyExtension::interface()->name)) {
@@ -658,7 +676,8 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
}
mGlobals.textInputMethodManager.reset(
- new QtWayland::qt_text_input_method_manager_v1(registry, id, 1));
+ new WithDestructor<QtWayland::qt_text_input_method_manager_v1,
+ qt_text_input_method_manager_v1_destroy>(registry, id, 1));
for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices))
inputDevice->setTextInputMethod(new QWaylandTextInputMethod(
this,
@@ -678,7 +697,8 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
}
mGlobals.textInputManagerv1.reset(
- new QtWayland::zwp_text_input_manager_v1(registry, id, 1));
+ new WithDestructor<QtWayland::zwp_text_input_manager_v1,
+ zwp_text_input_manager_v1_destroy>(registry, id, 1));
for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) {
auto textInput =
new QWaylandTextInputv1(this, mGlobals.textInputManagerv1->create_text_input());
@@ -700,7 +720,8 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
}
mGlobals.textInputManagerv2.reset(
- new QtWayland::zwp_text_input_manager_v2(registry, id, 1));
+ new WithDestructor<QtWayland::zwp_text_input_manager_v2,
+ zwp_text_input_manager_v2_destroy>(registry, id, 1));
for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices))
inputDevice->setTextInput(new QWaylandTextInputv2(
this, mGlobals.textInputManagerv2->get_text_input(inputDevice->wl_seat())));
@@ -715,9 +736,9 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices))
inputDevice->setTextInputMethod(nullptr);
}
-
mGlobals.textInputManagerv3.reset(
- new QtWayland::zwp_text_input_manager_v3(registry, id, 1));
+ new WithDestructor<QtWayland::zwp_text_input_manager_v3,
+ zwp_text_input_manager_v3_destroy>(registry, id, 1));
for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices))
inputDevice->setTextInput(new QWaylandTextInputv3(
this, mGlobals.textInputManagerv3->get_text_input(inputDevice->wl_seat())));
@@ -738,16 +759,21 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
screen->initXdgOutput(xdgOutputManager());
} else if (interface == QLatin1String(QtWayland::wp_fractional_scale_manager_v1::interface()->name)) {
mGlobals.fractionalScaleManager.reset(
- new QtWayland::wp_fractional_scale_manager_v1(registry, id, 1));
+ new WithDestructor<QtWayland::wp_fractional_scale_manager_v1,
+ wp_fractional_scale_manager_v1_destroy>(registry, id, 1));
} else if (interface == QLatin1String("wp_viewporter")) {
- mGlobals.viewporter.reset(new QtWayland::wp_viewporter(registry, id, qMin(1u, version)));
+ mGlobals.viewporter.reset(
+ new WithDestructor<QtWayland::wp_viewporter, wp_viewporter_destroy>(
+ registry, id, qMin(1u, version)));
} else if (interface == QLatin1String(QtWayland::wp_cursor_shape_manager_v1::interface()->name)) {
- mGlobals.cursorShapeManager.reset(
- new QtWayland::wp_cursor_shape_manager_v1(registry, id, std::min(1u, version)));
+ mGlobals.cursorShapeManager.reset(new WithDestructor<QtWayland::wp_cursor_shape_manager_v1,
+ wp_cursor_shape_manager_v1_destroy>(
+ registry, id, std::min(1u, version)));
} else if (
interface == QLatin1String(QtWayland::qt_toplevel_drag_manager_v1::interface()->name)) {
mGlobals.xdgToplevelDragManager.reset(
- new QtWayland::qt_toplevel_drag_manager_v1(registry, id, 1));
+ new WithDestructor<QtWayland::qt_toplevel_drag_manager_v1,
+ qt_toplevel_drag_manager_v1_destroy>(registry, id, 1));
}
mRegistryGlobals.append(RegistryGlobal(id, interface, version, registry));
diff --git a/src/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h
index 868811cca..477a5dbf2 100644
--- a/src/client/qwaylanddisplay_p.h
+++ b/src/client/qwaylanddisplay_p.h
@@ -128,8 +128,10 @@ public:
struct wl_display *wl_display() const { return mDisplay; }
struct ::wl_registry *wl_registry() { return object(); }
- const struct wl_compositor *wl_compositor() const { return mCompositor.object(); }
- QtWayland::wl_compositor *compositor() { return &mCompositor; }
+ QtWayland::wl_compositor *compositor()
+ {
+ return mGlobals.compositor.get();
+ }
QList<QWaylandInputDevice *> inputDevices() const { return mInputDevices; }
QWaylandInputDevice *defaultInputDevice() const;
@@ -225,7 +227,10 @@ public:
void addRegistryListener(RegistryListener listener, void *data);
void removeListener(RegistryListener listener, void *data);
- QWaylandShm *shm() const { return mShm.data(); }
+ QWaylandShm *shm() const
+ {
+ return mGlobals.shm.get();
+ }
void forceRoundTrip();
@@ -281,8 +286,6 @@ private:
std::unique_ptr<EventThread> m_eventThread;
wl_event_queue *m_frameEventQueue = nullptr;
QScopedPointer<EventThread> m_frameEventQueueThread;
- QtWayland::wl_compositor mCompositor;
- QScopedPointer<QWaylandShm> mShm;
QList<QWaylandScreen *> mWaitingScreens;
QList<QWaylandScreen *> mScreens;
QPlatformPlaceholderScreen *mPlaceholderScreen = nullptr;
@@ -313,6 +316,8 @@ private:
struct GlobalHolder
{
+ std::unique_ptr<QtWayland::wl_compositor> compositor;
+ std::unique_ptr<QWaylandShm> shm;
#if QT_CONFIG(wayland_datadevice)
std::unique_ptr<QWaylandDataDeviceManager> dndSelectionHandler;
#endif
diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp
index f52789fdc..c552988de 100644
--- a/src/client/qwaylandinputdevice.cpp
+++ b/src/client/qwaylandinputdevice.cpp
@@ -418,8 +418,13 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version,
#endif
}
-// Can't be in header because dtors for scoped pointers aren't known there.
-QWaylandInputDevice::~QWaylandInputDevice() = default;
+QWaylandInputDevice::~QWaylandInputDevice()
+{
+ if (version() >= WL_SEAT_RELEASE_SINCE_VERSION)
+ release();
+ else
+ wl_seat_destroy(object());
+}
void QWaylandInputDevice::seat_capabilities(uint32_t caps)
{
diff --git a/src/client/qwaylandinputmethodcontext.cpp b/src/client/qwaylandinputmethodcontext.cpp
index f03d8fb74..657208efb 100644
--- a/src/client/qwaylandinputmethodcontext.cpp
+++ b/src/client/qwaylandinputmethodcontext.cpp
@@ -25,6 +25,7 @@ QWaylandTextInputMethod::QWaylandTextInputMethod(QWaylandDisplay *display, struc
QWaylandTextInputMethod::~QWaylandTextInputMethod()
{
+ qt_text_input_method_v1_destroy(object());
}
void QWaylandTextInputMethod::text_input_method_v1_visible_changed(int32_t visible)
diff --git a/src/client/qwaylandnativeinterface.cpp b/src/client/qwaylandnativeinterface.cpp
index 65272f3c2..601f833aa 100644
--- a/src/client/qwaylandnativeinterface.cpp
+++ b/src/client/qwaylandnativeinterface.cpp
@@ -35,8 +35,10 @@ void *QWaylandNativeInterface::nativeResourceForIntegration(const QByteArray &re
if (lowerCaseResource == "display" || lowerCaseResource == "wl_display" || lowerCaseResource == "nativedisplay")
return m_integration->display()->wl_display();
- if (lowerCaseResource == "compositor")
- return const_cast<wl_compositor *>(m_integration->display()->wl_compositor());
+ if (lowerCaseResource == "compositor") {
+ if (auto compositor = m_integration->display()->compositor())
+ return compositor->object();
+ }
if (lowerCaseResource == "server_buffer_integration")
return m_integration->serverBufferIntegration();
@@ -76,7 +78,9 @@ wl_display *QtWaylandClient::QWaylandNativeInterface::display() const
wl_compositor *QtWaylandClient::QWaylandNativeInterface::compositor() const
{
- return const_cast<wl_compositor *>(m_integration->display()->wl_compositor());
+ if (auto compositor = m_integration->display()->compositor())
+ return compositor->object();
+ return nullptr;
}
wl_seat *QtWaylandClient::QWaylandNativeInterface::seat() const
@@ -129,8 +133,10 @@ void *QWaylandNativeInterface::nativeResourceForWindow(const QByteArray &resourc
if (lowerCaseResource == "display")
return m_integration->display()->wl_display();
- if (lowerCaseResource == "compositor")
- return const_cast<wl_compositor *>(m_integration->display()->wl_compositor());
+ if (lowerCaseResource == "compositor") {
+ if (auto compositor = m_integration->display()->compositor())
+ return compositor->object();
+ }
if (lowerCaseResource == "surface") {
QWaylandWindow *w = static_cast<QWaylandWindow*>(window->handle());
return w ? w->wlSurface() : nullptr;
diff --git a/src/client/qwaylandpointergestures.cpp b/src/client/qwaylandpointergestures.cpp
index 1cdd97edd..87079d800 100644
--- a/src/client/qwaylandpointergestures.cpp
+++ b/src/client/qwaylandpointergestures.cpp
@@ -14,6 +14,14 @@ QWaylandPointerGestures::QWaylandPointerGestures(QWaylandDisplay *display, uint
{
}
+QWaylandPointerGestures::~QWaylandPointerGestures() noexcept
+{
+ if (version() >= ZWP_POINTER_GESTURES_V1_RELEASE_SINCE_VERSION)
+ release();
+ else
+ zwp_pointer_gestures_v1_destroy(object());
+}
+
QWaylandPointerGestureSwipe *
QWaylandPointerGestures::createPointerGestureSwipe(QWaylandInputDevice *device)
{
diff --git a/src/client/qwaylandpointergestures_p.h b/src/client/qwaylandpointergestures_p.h
index 7e5a7e06f..06ee4a6ed 100644
--- a/src/client/qwaylandpointergestures_p.h
+++ b/src/client/qwaylandpointergestures_p.h
@@ -36,6 +36,7 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandPointerGestures : public QtWayland::zwp_poi
{
public:
explicit QWaylandPointerGestures(QWaylandDisplay *display, uint id, uint version);
+ ~QWaylandPointerGestures();
QWaylandPointerGestureSwipe *createPointerGestureSwipe(QWaylandInputDevice *device);
QWaylandPointerGesturePinch *createPointerGesturePinch(QWaylandInputDevice *device);
diff --git a/src/client/qwaylandprimaryselectionv1.cpp b/src/client/qwaylandprimaryselectionv1.cpp
index 999aba970..d72b8f749 100644
--- a/src/client/qwaylandprimaryselectionv1.cpp
+++ b/src/client/qwaylandprimaryselectionv1.cpp
@@ -20,6 +20,11 @@ QWaylandPrimarySelectionDeviceManagerV1::QWaylandPrimarySelectionDeviceManagerV1
{
}
+QWaylandPrimarySelectionDeviceManagerV1::~QWaylandPrimarySelectionDeviceManagerV1()
+{
+ destroy();
+}
+
QWaylandPrimarySelectionDeviceV1 *QWaylandPrimarySelectionDeviceManagerV1::createDevice(QWaylandInputDevice *seat)
{
return new QWaylandPrimarySelectionDeviceV1(this, seat);
diff --git a/src/client/qwaylandprimaryselectionv1_p.h b/src/client/qwaylandprimaryselectionv1_p.h
index 3591f0623..f39aec526 100644
--- a/src/client/qwaylandprimaryselectionv1_p.h
+++ b/src/client/qwaylandprimaryselectionv1_p.h
@@ -37,6 +37,7 @@ class QWaylandPrimarySelectionDeviceManagerV1 : public QtWayland::zwp_primary_se
{
public:
explicit QWaylandPrimarySelectionDeviceManagerV1(QWaylandDisplay *display, uint id, uint version);
+ ~QWaylandPrimarySelectionDeviceManagerV1();
QWaylandPrimarySelectionDeviceV1 *createDevice(QWaylandInputDevice *seat);
QWaylandDisplay *display() const { return m_display; }
diff --git a/src/client/qwaylandqtkey.cpp b/src/client/qwaylandqtkey.cpp
index f6bda97d8..079a03e0d 100644
--- a/src/client/qwaylandqtkey.cpp
+++ b/src/client/qwaylandqtkey.cpp
@@ -15,6 +15,11 @@ QWaylandQtKeyExtension::QWaylandQtKeyExtension(QWaylandDisplay *display, uint32_
{
}
+QWaylandQtKeyExtension::~QWaylandQtKeyExtension()
+{
+ zqt_key_v1_destroy(object());
+}
+
void QWaylandQtKeyExtension::zqt_key_v1_key(struct wl_surface *surface,
uint32_t time,
uint32_t type,
diff --git a/src/client/qwaylandqtkey_p.h b/src/client/qwaylandqtkey_p.h
index 223b05026..1544a0166 100644
--- a/src/client/qwaylandqtkey_p.h
+++ b/src/client/qwaylandqtkey_p.h
@@ -31,6 +31,7 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandQtKeyExtension : public QtWayland::zqt_key_
{
public:
QWaylandQtKeyExtension(QWaylandDisplay *display, uint32_t id);
+ ~QWaylandQtKeyExtension();
private:
QWaylandDisplay *m_display = nullptr;
diff --git a/src/client/qwaylandscreen.cpp b/src/client/qwaylandscreen.cpp
index ea109c8f5..3faef3f25 100644
--- a/src/client/qwaylandscreen.cpp
+++ b/src/client/qwaylandscreen.cpp
@@ -22,6 +22,11 @@ QWaylandXdgOutputManagerV1::QWaylandXdgOutputManagerV1(QWaylandDisplay* display,
{
}
+QWaylandXdgOutputManagerV1::~QWaylandXdgOutputManagerV1()
+{
+ destroy();
+}
+
QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id)
: QtWayland::wl_output(waylandDisplay->wl_registry(), id, qMin(version, 3))
, m_outputId(id)
@@ -44,8 +49,10 @@ QWaylandScreen::~QWaylandScreen()
{
if (zxdg_output_v1::isInitialized())
zxdg_output_v1::destroy();
- if (wl_output::isInitialized() && wl_output::version() >= WL_OUTPUT_RELEASE_SINCE_VERSION)
+ if (wl_output::version() >= WL_OUTPUT_RELEASE_SINCE_VERSION)
wl_output::release();
+ else
+ wl_output_destroy(wl_output::object());
}
uint QWaylandScreen::requiredEvents() const
diff --git a/src/client/qwaylandscreen_p.h b/src/client/qwaylandscreen_p.h
index a56e56f19..ff3d23217 100644
--- a/src/client/qwaylandscreen_p.h
+++ b/src/client/qwaylandscreen_p.h
@@ -33,6 +33,7 @@ class QWaylandCursor;
class Q_WAYLANDCLIENT_EXPORT QWaylandXdgOutputManagerV1 : public QtWayland::zxdg_output_manager_v1 {
public:
QWaylandXdgOutputManagerV1(QWaylandDisplay *display, uint id, uint version);
+ ~QWaylandXdgOutputManagerV1();
};
class Q_WAYLANDCLIENT_EXPORT QWaylandScreen : public QPlatformScreen,
diff --git a/src/client/qwaylandshm.cpp b/src/client/qwaylandshm.cpp
index 7c0bc4ddb..9ee7a96bc 100644
--- a/src/client/qwaylandshm.cpp
+++ b/src/client/qwaylandshm.cpp
@@ -16,7 +16,7 @@ QWaylandShm::QWaylandShm(QWaylandDisplay *display, int version, uint32_t id)
QWaylandShm::~QWaylandShm()
{
-
+ wl_shm_destroy(object());
}
void QWaylandShm::shm_format(uint32_t format)
diff --git a/src/client/qwaylandtabletv2.cpp b/src/client/qwaylandtabletv2.cpp
index a7c3458f7..73524c166 100644
--- a/src/client/qwaylandtabletv2.cpp
+++ b/src/client/qwaylandtabletv2.cpp
@@ -20,6 +20,11 @@ QWaylandTabletManagerV2::QWaylandTabletManagerV2(QWaylandDisplay *display, uint
createTabletSeat(seat);
}
+QWaylandTabletManagerV2::~QWaylandTabletManagerV2()
+{
+ destroy();
+}
+
QWaylandTabletSeatV2 *QWaylandTabletManagerV2::createTabletSeat(QWaylandInputDevice *seat)
{
return new QWaylandTabletSeatV2(this, seat);
diff --git a/src/client/qwaylandtabletv2_p.h b/src/client/qwaylandtabletv2_p.h
index 3e0f4372b..20a8a4f5a 100644
--- a/src/client/qwaylandtabletv2_p.h
+++ b/src/client/qwaylandtabletv2_p.h
@@ -42,6 +42,7 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandTabletManagerV2 : public QtWayland::zwp_tab
{
public:
explicit QWaylandTabletManagerV2(QWaylandDisplay *display, uint id, uint version);
+ ~QWaylandTabletManagerV2() override;
QWaylandTabletSeatV2 *createTabletSeat(QWaylandInputDevice *seat);
};
diff --git a/src/client/qwaylandtextinputv1.cpp b/src/client/qwaylandtextinputv1.cpp
index 3b45322b1..846ed95c8 100644
--- a/src/client/qwaylandtextinputv1.cpp
+++ b/src/client/qwaylandtextinputv1.cpp
@@ -46,6 +46,7 @@ QWaylandTextInputv1::~QWaylandTextInputv1()
{
if (m_resetCallback)
wl_callback_destroy(m_resetCallback);
+ zwp_text_input_v1_destroy(object());
}
void QWaylandTextInputv1::reset()
diff --git a/src/client/qwaylandtouch.cpp b/src/client/qwaylandtouch.cpp
index a88947e07..dfd04d446 100644
--- a/src/client/qwaylandtouch.cpp
+++ b/src/client/qwaylandtouch.cpp
@@ -23,6 +23,11 @@ QWaylandTouchExtension::QWaylandTouchExtension(QWaylandDisplay *display, uint32_
{
}
+QWaylandTouchExtension::~QWaylandTouchExtension()
+{
+ qt_touch_extension_destroy(object());
+}
+
void QWaylandTouchExtension::registerDevice(int caps)
{
// TODO number of touchpoints, actual name and ID
diff --git a/src/client/qwaylandtouch_p.h b/src/client/qwaylandtouch_p.h
index 8927f4e7e..e283f9009 100644
--- a/src/client/qwaylandtouch_p.h
+++ b/src/client/qwaylandtouch_p.h
@@ -32,6 +32,7 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandTouchExtension : public QtWayland::qt_touch
{
public:
QWaylandTouchExtension(QWaylandDisplay *display, uint32_t id);
+ ~QWaylandTouchExtension() override;
void touchCanceled();
diff --git a/src/client/qwaylandwindowmanagerintegration.cpp b/src/client/qwaylandwindowmanagerintegration.cpp
index dababe7c9..149190420 100644
--- a/src/client/qwaylandwindowmanagerintegration.cpp
+++ b/src/client/qwaylandwindowmanagerintegration.cpp
@@ -34,7 +34,6 @@ public:
QWaylandWindowManagerIntegrationPrivate::QWaylandWindowManagerIntegrationPrivate(QWaylandDisplay *waylandDisplay)
: m_waylandDisplay(waylandDisplay)
{
-
}
QWaylandWindowManagerIntegration::QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay)
@@ -45,7 +44,8 @@ QWaylandWindowManagerIntegration::QWaylandWindowManagerIntegration(QWaylandDispl
QWaylandWindowManagerIntegration::~QWaylandWindowManagerIntegration()
{
-
+ if (object())
+ qt_windowmanager_destroy(object());
}
bool QWaylandWindowManagerIntegration::showIsFullScreen() const
diff --git a/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp b/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp
index 3a3e8b00b..2e2076b0a 100644
--- a/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp
+++ b/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp
@@ -18,6 +18,12 @@ QWaylandWlShellIntegration::QWaylandWlShellIntegration() : QWaylandShellIntegrat
<< "by setting the environment variable QT_WAYLAND_SHELL_INTEGRATION";
}
+QWaylandWlShellIntegration::~QWaylandWlShellIntegration()
+{
+ if (object())
+ wl_shell_destroy(object());
+}
+
QWaylandShellSurface *QWaylandWlShellIntegration::createShellSurface(QWaylandWindow *window)
{
return new QWaylandWlShellSurface(get_shell_surface(window->wlSurface()), window);
diff --git a/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h b/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h
index fd3cb87f0..312a1089a 100644
--- a/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h
+++ b/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h
@@ -29,6 +29,7 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandWlShellIntegration
{
public:
QWaylandWlShellIntegration();
+ ~QWaylandWlShellIntegration();
QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override;
void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) override;
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp
index 8efc04086..8540724d8 100644
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp
@@ -43,6 +43,10 @@ QWaylandXdgActivationV1::requestXdgActivationToken(QWaylandDisplay *display,
return provider;
}
+QWaylandXdgActivationTokenV1::~QWaylandXdgActivationTokenV1()
+{
+ destroy();
+}
}
QT_END_NAMESPACE
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h b/src/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h
index 2f42d9258..bddb5c614 100644
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h
@@ -33,6 +33,7 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandXdgActivationTokenV1
{
Q_OBJECT
public:
+ ~QWaylandXdgActivationTokenV1() override;
void xdg_activation_token_v1_done(const QString &token) override { Q_EMIT done(token); }
Q_SIGNALS: