summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@viroteck.net>2014-08-21 13:45:34 +0200
committerRobin Burchell <robin.burchell@viroteck.net>2014-08-21 13:52:48 +0200
commit39a537b1ef7edb77cf87292d4ad2e93ea357f448 (patch)
tree70262f055718ba07c1761eb892e41792fb001395 /examples
parent722be68169339d96639d2ef9c765fff726123c9f (diff)
QWindowCompositor: Prevent double delete.
With a SHM client, if a null attach happened, then the old buffer would be deleted but left with a dangling pointer which would be deleted again on the destructor. This was revealed by tst_dialog. Change-Id: I89e22487e7ec982789a4b7dfd45e5db7db3222d1 Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/qwindow-compositor/qwindowcompositor.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/examples/qwindow-compositor/qwindowcompositor.cpp b/examples/qwindow-compositor/qwindowcompositor.cpp
index a17af929d..73182ba33 100644
--- a/examples/qwindow-compositor/qwindowcompositor.cpp
+++ b/examples/qwindow-compositor/qwindowcompositor.cpp
@@ -75,10 +75,12 @@ public:
void attach(const QWaylandBufferRef &ref) Q_DECL_OVERRIDE
{
if (bufferRef) {
- if (bufferRef.isShm())
+ if (bufferRef.isShm()) {
delete shmTex;
- else
+ shmTex = 0;
+ } else {
bufferRef.destroyTexture();
+ }
}
bufferRef = ref;