diff options
author | Trond Kjernåsen <trond.kjernasen@nokia.com> | 2010-07-06 14:18:02 (GMT) |
---|---|---|
committer | Trond Kjernåsen <trond.kjernasen@nokia.com> | 2010-07-06 14:31:18 (GMT) |
commit | 591e2a1e096618979250f062648b731367e60710 (patch) | |
tree | 0c1f2c26813f1852ff8201b6de7c5ab5e0c4c8cc /src/opengl | |
parent | 7629184953898416c5ffa302b761e1ee3f65d9ee (diff) | |
download | Qt-591e2a1e096618979250f062648b731367e60710.zip Qt-591e2a1e096618979250f062648b731367e60710.tar.gz Qt-591e2a1e096618979250f062648b731367e60710.tar.bz2 |
Don't call GetDC() nedlessly.
It seems that the CS_OWNDC class style flag only returns the same
DC when GetDC() is called in the same thread that created the window.
This in turn generates a bad DC resource leak if you have a rendering
thread with one or more GL context switches, so just call GetDC() when
you actually need to.
Reviewed-by: Kim
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/qgl_win.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/opengl/qgl_win.cpp b/src/opengl/qgl_win.cpp index 5ab944a..52988b6 100644 --- a/src/opengl/qgl_win.cpp +++ b/src/opengl/qgl_win.cpp @@ -1283,7 +1283,7 @@ void QGLContext::makeCurrent() if (d->rc == wglGetCurrentContext() || !d->valid) // already current return; - if (d->win) { + if (d->win && !d->dc) { d->dc = GetDC(d->win); if (!d->dc) { qwglError("QGLContext::makeCurrent()", "GetDC()"); |