diff options
-rw-r--r-- | src/opengl/qwindowsurface_gl.cpp | 19 | ||||
-rw-r--r-- | src/opengl/qwindowsurface_gl_p.h | 1 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 6b82ed3..b86fb78 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -199,6 +199,7 @@ public: return widget; } + // destroys the share widget and prevents recreation void cleanup() { QGLWidget *w = widget; cleanedUp = true; @@ -206,6 +207,20 @@ public: delete w; } + // destroys the share widget, but allows it to be recreated later on + void destroy() { + if (cleanedUp) + return; + + QGLWidget *w = widget; + + // prevent potential recursions + cleanedUp = true; + widget = 0; + delete w; + cleanedUp = false; + } + static bool cleanedUp; private: @@ -233,6 +248,10 @@ QGLWidget* qt_gl_share_widget() return _qt_gl_share_widget()->shareWidget(); } +void qt_destroy_gl_share_widget() +{ + _qt_gl_share_widget()->destroy(); +} struct QGLWindowSurfacePrivate { diff --git a/src/opengl/qwindowsurface_gl_p.h b/src/opengl/qwindowsurface_gl_p.h index 5e670fe..ffc2e86 100644 --- a/src/opengl/qwindowsurface_gl_p.h +++ b/src/opengl/qwindowsurface_gl_p.h @@ -67,6 +67,7 @@ class QWidget; struct QGLWindowSurfacePrivate; Q_OPENGL_EXPORT QGLWidget* qt_gl_share_widget(); +Q_OPENGL_EXPORT void qt_destroy_gl_share_widget(); class QGLWindowSurfaceGLPaintDevice : public QGLPaintDevice { |