diff options
author | Robin Burchell <robin.burchell@viroteck.net> | 2014-08-21 13:45:34 +0200 |
---|---|---|
committer | Robin Burchell <robin.burchell@viroteck.net> | 2014-08-21 13:52:48 +0200 |
commit | 39a537b1ef7edb77cf87292d4ad2e93ea357f448 (patch) | |
tree | 70262f055718ba07c1761eb892e41792fb001395 | |
parent | 722be68169339d96639d2ef9c765fff726123c9f (diff) | |
download | qtwayland-39a537b1ef7edb77cf87292d4ad2e93ea357f448.tar.gz |
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>
-rw-r--r-- | examples/qwindow-compositor/qwindowcompositor.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/examples/qwindow-compositor/qwindowcompositor.cpp b/examples/qwindow-compositor/qwindowcompositor.cpp index a17af929..73182ba3 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; |