Skip to content

Commit eca92de

Browse files
committed
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 <[email protected]> Reviewed-by: Allan Sandfeld Jensen <[email protected]>
1 parent 8bc8777 commit eca92de

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/core/gl_context_qt.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,16 @@ scoped_refptr<GLContext> GLContext::CreateGLContext(GLShareGroup* share_group, G
146146
{
147147
#if defined(OS_WIN)
148148
scoped_refptr<GLContext> context;
149-
if (GetGLImplementation() == kGLImplementationDesktopGL)
149+
if (GetGLImplementation() == kGLImplementationDesktopGL) {
150150
context = new GLContextWGL(share_group);
151-
else
151+
if (!context->Initialize(compatible_surface, gpu_preference)) {
152+
delete context;
153+
return nullptr;
154+
}
155+
return context;
156+
} else {
152157
context = new GLContextEGL(share_group);
158+
}
153159
#else
154160
scoped_refptr<GLContext> context = new GLContextEGL(share_group);
155161
#endif

0 commit comments

Comments
 (0)