diff options
author | Michal Klocek <michal.klocek@qt.io> | 2019-09-30 15:27:19 +0200 |
---|---|---|
committer | Michal Klocek <michal.klocek@qt.io> | 2019-12-19 16:44:57 +0200 |
commit | 28b138cbc21c4bed7b18b70bb98a690d000ad2f9 (patch) | |
tree | 6538d94f2e30884d2589501e2e220dcdc1349cf6 /src | |
parent | 277b8dde1ace28ea59f41e4f87d0291094106c74 (diff) |
Add check for global share context for QOpenGLWidget initialize
Fixes: QTBUG-78863
Change-Id: I678f66a2057fb9c98863e19eb09042306e72f68a
(cherry picked from commit ce2fc51914f809369d5096e7a0621229dd9eaef9)
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/kernel/qopenglwidget.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp index 7aef74c507..e58994b04c 100644 --- a/src/widgets/kernel/qopenglwidget.cpp +++ b/src/widgets/kernel/qopenglwidget.cpp @@ -788,10 +788,12 @@ void QOpenGLWidgetPrivate::initialize() if (initialized) return; - // Get our toplevel's context with which we will share in order to make the - // texture usable by the underlying window's backingstore. + // If no global shared context get our toplevel's context with which we + // will share in order to make the texture usable by the underlying window's backingstore. QWidget *tlw = q->window(); - QOpenGLContext *shareContext = get(tlw)->shareContext(); + QOpenGLContext *shareContext = qt_gl_global_share_context(); + if (!shareContext) + shareContext = get(tlw)->shareContext(); // If shareContext is null, showing content on-screen will not work. // However, offscreen rendering and grabFramebuffer() will stay fully functional. |