summaryrefslogtreecommitdiffstats
path: root/src/compositor
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2018-12-20 11:52:12 +0100
committerJohan Helsing <johan.helsing@qt.io>2018-12-22 13:18:05 +0000
commitf2dc41b5babf0a7b51a1735f290540d7be695042 (patch)
tree316dd7b08653218e0434e3042b00cdd70000e629 /src/compositor
parent1dc85b95ab0adc1e805d059e2c35c671ef790011 (diff)
Compositor: Fix crash in QWaylandSurface::waylandClient
Adds a test for customSurface which crashed without the fix. Fixes: QTBUG-72688 Change-Id: I30c50e474379c61b90b2dd294eae9a7c88c105a2 Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
Diffstat (limited to 'src/compositor')
-rw-r--r--src/compositor/compositor_api/qwaylandsurface.cpp13
-rw-r--r--src/compositor/compositor_api/qwaylandsurface.h2
2 files changed, 14 insertions, 1 deletions
diff --git a/src/compositor/compositor_api/qwaylandsurface.cpp b/src/compositor/compositor_api/qwaylandsurface.cpp
index 13ae28220..050ab5641 100644
--- a/src/compositor/compositor_api/qwaylandsurface.cpp
+++ b/src/compositor/compositor_api/qwaylandsurface.cpp
@@ -431,6 +431,19 @@ QWaylandClient *QWaylandSurface::client() const
}
/*!
+ * \property QWaylandSurface::waylandClient
+ *
+ * This property holds the \c wl_client using this QWaylandSurface.
+ */
+::wl_client *QWaylandSurface::waylandClient() const
+{
+ if (auto *c = client())
+ return c->client();
+
+ return nullptr;
+}
+
+/*!
* \qmlproperty bool QtWaylandCompositor::WaylandSurface::hasContent
*
* This property holds whether the WaylandSurface has content.
diff --git a/src/compositor/compositor_api/qwaylandsurface.h b/src/compositor/compositor_api/qwaylandsurface.h
index c208c16d4..a138b2af5 100644
--- a/src/compositor/compositor_api/qwaylandsurface.h
+++ b/src/compositor/compositor_api/qwaylandsurface.h
@@ -103,7 +103,7 @@ public:
bool isInitialized() const;
QWaylandClient *client() const;
- struct wl_client *waylandClient() const { return client()->client(); }
+ ::wl_client *waylandClient() const;
bool setRole(QWaylandSurfaceRole *role, wl_resource *errorResource, uint32_t errorCode);
QWaylandSurfaceRole *role() const;