Add check for global share context for QOpenGLWidget initialize
Fixes: QTBUG-78863 Change-Id: I678f66a2057fb9c98863e19eb09042306e72f68a Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
parent
0c1d23db7b
commit
ce2fc51914
@ -788,10 +788,12 @@ void QOpenGLWidgetPrivate::initialize()
|
|||||||
if (initialized)
|
if (initialized)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Get our toplevel's context with which we will share in order to make the
|
// If no global shared context get our toplevel's context with which we
|
||||||
// texture usable by the underlying window's backingstore.
|
// will share in order to make the texture usable by the underlying window's backingstore.
|
||||||
QWidget *tlw = q->window();
|
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.
|
// If shareContext is null, showing content on-screen will not work.
|
||||||
// However, offscreen rendering and grabFramebuffer() will stay fully functional.
|
// However, offscreen rendering and grabFramebuffer() will stay fully functional.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user