summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2019-04-05 09:44:40 +0200
committerJohan Helsing <johan.helsing@qt.io>2019-04-08 07:42:56 +0000
commite07a94d7ac67994ecf3da26ad9509d97b80cd238 (patch)
tree836979173a477ae23e1452fe0a16c1920ea71bc7
parent8fb8627fffb12ccf25a9b97a4d6f4cfdd83ea714 (diff)
Compositor: Don't destroy wl_display from platform integration
If the platform integration provides the wl_display, it should be the platform integration's responsibility to destroy it as well. Task-number: QTBUG-74879 Change-Id: I18999a5bd8cdc2900cac86f156f2adaaebf86158 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
-rw-r--r--src/compositor/compositor_api/qwaylandcompositor.cpp9
-rw-r--r--src/compositor/compositor_api/qwaylandcompositor_p.h1
2 files changed, 8 insertions, 2 deletions
diff --git a/src/compositor/compositor_api/qwaylandcompositor.cpp b/src/compositor/compositor_api/qwaylandcompositor.cpp
index 05323543..e95e9a72 100644
--- a/src/compositor/compositor_api/qwaylandcompositor.cpp
+++ b/src/compositor/compositor_api/qwaylandcompositor.cpp
@@ -162,8 +162,12 @@ QWaylandCompositorPrivate::QWaylandCompositorPrivate(QWaylandCompositor *composi
{
if (QGuiApplication::platformNativeInterface())
display = static_cast<wl_display*>(QGuiApplication::platformNativeInterface()->nativeResourceForIntegration("server_wl_display"));
- if (!display)
+
+ if (!display) {
display = wl_display_create();
+ ownsDisplay = true;
+ }
+
eventHandler.reset(new QtWayland::WindowSystemEventHandler(compositor));
timer.start();
@@ -246,7 +250,8 @@ QWaylandCompositorPrivate::~QWaylandCompositorPrivate()
// Some client buffer integrations need to clean up before the destroying the wl_display
client_buffer_integration.reset();
- wl_display_destroy(display);
+ if (ownsDisplay)
+ wl_display_destroy(display);
}
void QWaylandCompositorPrivate::preInit()
diff --git a/src/compositor/compositor_api/qwaylandcompositor_p.h b/src/compositor/compositor_api/qwaylandcompositor_p.h
index cdf4be6b..d91977de 100644
--- a/src/compositor/compositor_api/qwaylandcompositor_p.h
+++ b/src/compositor/compositor_api/qwaylandcompositor_p.h
@@ -137,6 +137,7 @@ protected:
QList<int> externally_added_socket_fds;
#endif
struct wl_display *display = nullptr;
+ bool ownsDisplay = false;
QList<QWaylandSeat *> seats;
QList<QWaylandOutput *> outputs;