summaryrefslogtreecommitdiffstats
path: root/src/core/gl_context_qt.cpp
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@theqtcompany.com>2015-10-28 17:04:51 +0100
committerJoerg Bornemann <joerg.bornemann@theqtcompany.com>2015-10-30 10:02:02 +0000
commiteca92de29c5a9048f4b15c5f9aa96b7ad8235b49 (patch)
tree466e18fa314c8e1d563930e327b07230b6869431 /src/core/gl_context_qt.cpp
parent8bc8777ef3b4fd9032eb5b6be46ee47f60fc9ec2 (diff)
fix frequent deadlocks on Windows
With a desktop OpenGL build of Qt we encountered frequent deadlocks when creating OpenGL contexts. Initialize the context directly on the calling thread instead of the browser thread and do not synchronize with the browser thread. Task-number: QTBUG-48276 Change-Id: I0970c66cb230881cdc53f22d4a255ea08e6fe63a Reviewed-by: Michael BrĂ¼ning <michael.bruning@theqtcompany.com> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Diffstat (limited to 'src/core/gl_context_qt.cpp')
-rw-r--r--src/core/gl_context_qt.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/core/gl_context_qt.cpp b/src/core/gl_context_qt.cpp
index b350c3c5b..3a6de6935 100644
--- a/src/core/gl_context_qt.cpp
+++ b/src/core/gl_context_qt.cpp
@@ -146,10 +146,16 @@ scoped_refptr<GLContext> GLContext::CreateGLContext(GLShareGroup* share_group, G
{
#if defined(OS_WIN)
scoped_refptr<GLContext> context;
- if (GetGLImplementation() == kGLImplementationDesktopGL)
+ if (GetGLImplementation() == kGLImplementationDesktopGL) {
context = new GLContextWGL(share_group);
- else
+ if (!context->Initialize(compatible_surface, gpu_preference)) {
+ delete context;
+ return nullptr;
+ }
+ return context;
+ } else {
context = new GLContextEGL(share_group);
+ }
#else
scoped_refptr<GLContext> context = new GLContextEGL(share_group);
#endif