diff options
author | Paul Olav Tvete <paul.tvete@qt.io> | 2018-07-03 16:25:49 +0200 |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@qt.io> | 2018-08-04 11:19:24 +0000 |
commit | a6cfa65eae4d15c7ad5e7411d998332179080fbd (patch) | |
tree | a03af738c0f6f89cbbf6c72f81bc52f3a029e074 /examples | |
parent | 2c48ee65e8c3b894caec214641723d0777fc60b8 (diff) |
Make sure we don't use deleted memory in example
The view has a pointer to a QOpenGLTexture that is owned by the
buffer. Don't keep using that pointer after the buffer has deleted
it.
Task-number: QTBUG-69384
Change-Id: I48fd813e0dcb74db04d217238be7b0b6b345fc11
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/wayland/qwindow-compositor/compositor.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/examples/wayland/qwindow-compositor/compositor.cpp b/examples/wayland/qwindow-compositor/compositor.cpp index 8ba8929e1..e224cd1c3 100644 --- a/examples/wayland/qwindow-compositor/compositor.cpp +++ b/examples/wayland/qwindow-compositor/compositor.cpp @@ -72,8 +72,11 @@ View::View(Compositor *compositor) QOpenGLTexture *View::getTexture() { - if (advance()) { - QWaylandBufferRef buf = currentBuffer(); + bool newContent = advance(); + QWaylandBufferRef buf = currentBuffer(); + if (!buf.hasContent()) + m_texture = nullptr; + if (newContent) { m_texture = buf.toOpenGLTexture(); if (surface()) { m_size = surface()->size(); |