path: root/src/gui/kernel/qopenglwindow.cpp
diff options
Diffstat (limited to 'src/gui/kernel/qopenglwindow.cpp')
1 files changed, 25 insertions, 0 deletions
diff --git a/src/gui/kernel/qopenglwindow.cpp b/src/gui/kernel/qopenglwindow.cpp
index c58e296b5a..741df78407 100644
--- a/src/gui/kernel/qopenglwindow.cpp
+++ b/src/gui/kernel/qopenglwindow.cpp
@@ -336,6 +336,31 @@ QOpenGLWindow::QOpenGLWindow(QOpenGLContext *shareContext, UpdateBehavior update
+ Destroys the QOpenGLWindow instance, freeing its resources.
+ The OpenGLWindow's context is made current in the destructor, allowing for
+ safe destruction of any child object that may need to release OpenGL
+ resources belonging to the context provided by this window.
+ \warning if you have objects wrapping OpenGL resources (such as
+ QOpenGLBuffer, QOpenGLShaderProgram, etc.), as members of a QOpenGLWindow
+ subclass, you may need to add a call to makeCurrent() in that subclass'
+ destructor as well. Due to the rules of C++ object destruction, those objects
+ will be destroyed \e{before} calling this function (but after that the
+ destructor of the subclass has run), therefore making the OpenGL context
+ current in this function happens too late for their safe disposal.
+ \sa makeCurrent
+ \since 5.5
+ makeCurrent();
\return the update behavior for this QOpenGLWindow.