aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/rendercontrol
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@digia.com>2014-09-17 16:18:00 +0200
committerLaszlo Agocs <laszlo.agocs@digia.com>2014-09-18 10:06:57 +0200
commit72eef1da9e34aace7b0e2bc601d88f6b5363c075 (patch)
tree81034e182d88bb0a20ff6765c35e8c2eaa4121db /examples/quick/rendercontrol
parent0129887195c7255f41515f72ceb213a38b98f72d (diff)
Avoid crashing the rendercontrol example on exit
Task-number: QTBUG-41278 Change-Id: I456467698e66fb28f1bf6a05d85771ac25f454d0 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'examples/quick/rendercontrol')
-rw-r--r--examples/quick/rendercontrol/window.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/examples/quick/rendercontrol/window.cpp b/examples/quick/rendercontrol/window.cpp
index 396e9f8afa..4813936538 100644
--- a/examples/quick/rendercontrol/window.cpp
+++ b/examples/quick/rendercontrol/window.cpp
@@ -111,8 +111,11 @@ Window::Window()
Window::~Window()
{
- // Make sure the context is current while doing cleanup.
- m_context->makeCurrent(this);
+ // Make sure the context is current while doing cleanup. Note that we use the
+ // offscreen surface here because passing 'this' at this point is not safe: the
+ // underlying platform window may already be destroyed. To avoid all the trouble, use
+ // another surface that is valid for sure.
+ m_context->makeCurrent(m_offscreenSurface);
// Delete the render control first since it will free the scenegraph resources.
// Destroy the QQuickWindow only afterwards.