diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2009-06-17 08:25:03 (GMT) |
---|---|---|
committer | Samuel Rødal <sroedal@trolltech.com> | 2009-06-17 08:56:33 (GMT) |
commit | 4cacc45d10e59bb8915b8d76c359df7a8ad0a846 (patch) | |
tree | 1cc67f1bce59e9c85b9670831ab9d2acbf4b1269 /src/opengl/qwindowsurface_gl.cpp | |
parent | 583a306bb66601d4aa1ecc0429cc9e02aa6f9246 (diff) | |
download | Qt-4cacc45d10e59bb8915b8d76c359df7a8ad0a846.zip Qt-4cacc45d10e59bb8915b8d76c359df7a8ad0a846.tar.gz Qt-4cacc45d10e59bb8915b8d76c359df7a8ad0a846.tar.bz2 |
Prevented infinite recursion in GL graphics system.
If creating a QGLWidget triggers the creation of a QPixmap then we might
end up in an infinite recursion due to QPixmap trying to access
qt_gl_share_widget(). This can happen via setWindowIcon for example.
Adding an initializing flag to QGLGlobalShareWidget and preventing
QGLFramebufferObject::hasOpenGLFramebufferObjects() and
::hasOpenGLFramebufferBlit() from creating a QGLWidget every time they
are called with no active GL context.
Reviewed-by: Trond
Diffstat (limited to 'src/opengl/qwindowsurface_gl.cpp')
-rw-r--r-- | src/opengl/qwindowsurface_gl.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 50d0ae7..3a7a07e 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -184,11 +184,13 @@ QGLGraphicsSystem::QGLGraphicsSystem() class QGLGlobalShareWidget { public: - QGLGlobalShareWidget() : widget(0) {} + QGLGlobalShareWidget() : widget(0), initializing(false) {} QGLWidget *shareWidget() { - if (!widget && !cleanedUp) { + if (!initializing && !widget && !cleanedUp) { + initializing = true; widget = new QGLWidget; + initializing = false; } return widget; } @@ -204,6 +206,7 @@ public: private: QGLWidget *widget; + bool initializing; }; bool QGLGlobalShareWidget::cleanedUp = false; |