diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2011-10-07 14:45:40 +0200 |
---|---|---|
committer | Jan-Arve Saether <jan-arve.saether@nokia.com> | 2011-10-07 14:45:40 +0200 |
commit | a0feeef52efde872c6d6e458c8e15616da0bf74f (patch) | |
tree | 8c846d041bbce0ac4f10eac1b1b93250144f7f60 /src/gui/image/qpixmap_mac.cpp | |
parent | 74251fb0fc57b1e0f7db0b561e4aa4c0347f6f37 (diff) |
fix possible race conditions
the initialization guard must be set after the initialization is done;
for the code assumed to be only executed in a single thread, this change was done
just for consistency - in order to avoid similar issues by copy-pasting in future
Merge-request: 2655
Reviewed-by: Jan-Arve Saether <jan-arve.saether@nokia.com>
Diffstat (limited to 'src/gui/image/qpixmap_mac.cpp')
-rw-r--r-- | src/gui/image/qpixmap_mac.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/image/qpixmap_mac.cpp b/src/gui/image/qpixmap_mac.cpp index 47b6eef761..aa1571bc6d 100644 --- a/src/gui/image/qpixmap_mac.cpp +++ b/src/gui/image/qpixmap_mac.cpp @@ -752,7 +752,8 @@ static PtrglReadPixels ptrglReadPixels = 0; static bool resolveOpenGLSymbols() { - if (ptrCGLChoosePixelFormat == 0) { + static bool triedResolve = false; + if (!triedResolve) { QLibrary library(QLatin1String("/System/Library/Frameworks/OpenGL.framework/OpenGL")); ptrCGLChoosePixelFormat = (PtrCGLChoosePixelFormat)(library.resolve("CGLChoosePixelFormat")); ptrCGLClearDrawable = (PtrCGLClearDrawable)(library.resolve("CGLClearDrawable")); @@ -765,6 +766,7 @@ static bool resolveOpenGLSymbols() ptrglPixelStorei = (PtrglPixelStorei)(library.resolve("glPixelStorei")); ptrglReadBuffer = (PtrglReadBuffer)(library.resolve("glReadBuffer")); ptrglReadPixels = (PtrglReadPixels)(library.resolve("glReadPixels")); + triedResolve = true; } return ptrCGLChoosePixelFormat && ptrCGLClearDrawable && ptrCGLCreateContext && ptrCGLDestroyContext && ptrCGLDestroyPixelFormat && ptrCGLSetCurrentContext |