summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2017-08-15 13:22:41 +0200
committerJohan Helsing <johan.helsing@qt.io>2017-08-16 14:44:39 +0000
commite3feecfd96d8fcd65556d325c806153a3495d5b3 (patch)
tree491af7804959582f0313df8ed75a0cfb4d7efa81
parent974ea152751819f5dfa6ddfe39e6db526002ad33 (diff)
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.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/compositor/extensions/qwaylandxdgshellv6.cpp b/src/compositor/extensions/qwaylandxdgshellv6.cpp
index a3a310616..dc00e7204 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)",