summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2016-04-19 10:49:29 +0200
committerJohan Helsing <johan.helsing@qt.io>2016-04-19 09:31:21 +0000
commit15216555593740029f3c25ee16dc4dc248a017b7 (patch)
tree36c131e2f3b544c5e59ce6872194f0651174069b /examples
parent83001f38500542237cea163d3e03119f5e8a8336 (diff)
downloadqtwayland-15216555593740029f3c25ee16dc4dc248a017b7.tar.gz
Fix undefined behavior in qwindow-compositor
m_xdgSurface and m_xdgPopup were left uninitialized. Fixes a crash when resizing wl_shell clients. Change-Id: I8f4b05e395ac6088d9f40bbe9cca6141ee12dfc9 Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com> Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/wayland/qwindow-compositor/windowcompositor.cpp8
-rw-r--r--examples/wayland/qwindow-compositor/windowcompositor.h2
2 files changed, 9 insertions, 1 deletions
diff --git a/examples/wayland/qwindow-compositor/windowcompositor.cpp b/examples/wayland/qwindow-compositor/windowcompositor.cpp
index 5b3b6905..e9177872 100644
--- a/examples/wayland/qwindow-compositor/windowcompositor.cpp
+++ b/examples/wayland/qwindow-compositor/windowcompositor.cpp
@@ -51,6 +51,14 @@
#include <QDebug>
+WindowCompositorView::WindowCompositorView()
+ : m_texture(0)
+ , m_wlShellSurface(nullptr)
+ , m_xdgSurface(nullptr)
+ , m_xdgPopup(nullptr)
+ , m_parentView(nullptr)
+{}
+
GLuint WindowCompositorView::getTexture() {
if (advance()) {
if (m_texture)
diff --git a/examples/wayland/qwindow-compositor/windowcompositor.h b/examples/wayland/qwindow-compositor/windowcompositor.h
index c8b796ee..96af01f8 100644
--- a/examples/wayland/qwindow-compositor/windowcompositor.h
+++ b/examples/wayland/qwindow-compositor/windowcompositor.h
@@ -58,7 +58,7 @@ class WindowCompositorView : public QWaylandView
{
Q_OBJECT
public:
- WindowCompositorView() : m_texture(0), m_wlShellSurface(0), m_parentView(0) {}
+ WindowCompositorView();
GLuint getTexture();
QPointF position() const { return m_position; }
void setPosition(const QPointF &pos) { m_position = pos; }