summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2010-08-12 10:34:36 (GMT)
committerSamuel Rødal <samuel.rodal@nokia.com>2010-08-12 11:03:41 (GMT)
commitdd916743ad6182b38db40226e82b46596942ba39 (patch)
treec744f788432b740220c6db90183fb6727a0513ca
parent81529d52a76b48aa89b7ac8c9044da4ea5c11f3f (diff)
downloadQt-dd916743ad6182b38db40226e82b46596942ba39.zip
Qt-dd916743ad6182b38db40226e82b46596942ba39.tar.gz
Qt-dd916743ad6182b38db40226e82b46596942ba39.tar.bz2
Added way to destroy the share widget in the GL graphics system.
This lets us destroy the share widget temporarily if we want to free up OpenGL resources for a while. Reviewed-by: Gunnar Sletta
-rw-r--r--src/opengl/qwindowsurface_gl.cpp19
-rw-r--r--src/opengl/qwindowsurface_gl_p.h1
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
{