diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2017-08-15 13:22:41 +0200 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2017-08-16 14:44:39 +0000 |
commit | e3feecfd96d8fcd65556d325c806153a3495d5b3 (patch) | |
tree | 491af7804959582f0313df8ed75a0cfb4d7efa81 | |
parent | 974ea152751819f5dfa6ddfe39e6db526002ad33 (diff) | |
download | qtwayland-e3feecfd96d8fcd65556d325c806153a3495d5b3.tar.gz |
Fix nullptr dereference when handling a popup with no positioner
If positioner was null, we would try to print its data in the error message.
Change-Id: Ic6d5d5cd8039dbfd97d4cbbcc34fb18207ae633e
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
-rw-r--r-- | src/compositor/extensions/qwaylandxdgshellv6.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/compositor/extensions/qwaylandxdgshellv6.cpp b/src/compositor/extensions/qwaylandxdgshellv6.cpp index a3a31061..dc00e720 100644 --- a/src/compositor/extensions/qwaylandxdgshellv6.cpp +++ b/src/compositor/extensions/qwaylandxdgshellv6.cpp @@ -356,7 +356,12 @@ void QWaylandXdgSurfaceV6Private::zxdg_surface_v6_get_popup(QtWaylandServer::zxd } QWaylandXdgPositionerV6 *positioner = QWaylandXdgPositionerV6::fromResource(positionerResource); - if (!positioner || !positioner->m_data.isComplete()) { + if (!positioner) { + wl_resource_post_error(resource->handle, ZXDG_SHELL_V6_ERROR_INVALID_POSITIONER, + "zxdg_surface_v6.get_popup without positioner"); + return; + } + if (!positioner->m_data.isComplete()) { QWaylandXdgPositionerV6Data p = positioner->m_data; wl_resource_post_error(resource->handle, ZXDG_SHELL_V6_ERROR_INVALID_POSITIONER, "zxdg_surface_v6.get_popup with invalid positioner (size: %dx%d, anchorRect: %dx%d)", |