diff options
Diffstat (limited to 'examples/quick/rendercontrol')
-rw-r--r-- | examples/quick/rendercontrol/window.cpp | 7 |
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. |