diff options
author | Michal Klocek <michal.klocek@qt.io> | 2019-09-30 15:27:19 +0200 |
---|---|---|
committer | Michal Klocek <michal.klocek@qt.io> | 2019-10-08 10:41:02 +0200 |
commit | ce2fc51914f809369d5096e7a0621229dd9eaef9 (patch) | |
tree | feec481b3d8d6e8191387450b6e30c16501b71a4 | |
parent | 0c1d23db7bada763f1e5d82cebda0e7738549b48 (diff) |
Add check for global share context for QOpenGLWidget initialize
Fixes: QTBUG-78863
Change-Id: I678f66a2057fb9c98863e19eb09042306e72f68a
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
-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 374ea53726..a88054a0d0 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. |