diff options
-rw-r--r-- | src/compositor/compositor_api/qwaylandcompositor.cpp | 9 | ||||
-rw-r--r-- | src/compositor/compositor_api/qwaylandcompositor_p.h | 1 |
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; |