diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2017-06-16 15:24:55 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2017-06-20 09:47:46 +0000 |
commit | ccca8c94359e7f07333b710119bfdf00b25b78fd (patch) | |
tree | 68121dc44002e6669968a8c73ad98e9473f21f2b | |
parent | 932fe019fe94a3261b940c0ab9cd761ca808bb06 (diff) |
Fix dereferencing non-existent TLW with hidden QOpenGLWidget
Amends 2ea90c56f2924acc5c620ed7c29a48c72a42efd3.
Task-number: QTBUG-61280
Change-Id: Iae086a47f5cbe2e423b0831c3cd226507879cbbb
Reviewed-by: Mika Salmela <mika.salmela@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r-- | src/widgets/kernel/qopenglwidget.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp index a83884ca03..5ea306f463 100644 --- a/src/widgets/kernel/qopenglwidget.cpp +++ b/src/widgets/kernel/qopenglwidget.cpp @@ -815,18 +815,18 @@ void QOpenGLWidgetPrivate::initialize() // Propagate settings that make sense only for the tlw. Note that this only // makes sense for properties that get picked up even after the native // window is created. - QSurfaceFormat tlwFormat; - if (tlw->windowHandle()) - tlwFormat = tlw->windowHandle()->format(); - if (requestedFormat.swapInterval() != tlwFormat.swapInterval()) { - // Most platforms will pick up the changed swap interval on the next - // makeCurrent or swapBuffers. - tlwFormat.setSwapInterval(requestedFormat.swapInterval()); - tlw->windowHandle()->setFormat(tlwFormat); - } - if (requestedFormat.swapBehavior() != tlwFormat.swapBehavior()) { - tlwFormat.setSwapBehavior(requestedFormat.swapBehavior()); - tlw->windowHandle()->setFormat(tlwFormat); + if (tlw->windowHandle()) { + QSurfaceFormat tlwFormat = tlw->windowHandle()->format(); + if (requestedFormat.swapInterval() != tlwFormat.swapInterval()) { + // Most platforms will pick up the changed swap interval on the next + // makeCurrent or swapBuffers. + tlwFormat.setSwapInterval(requestedFormat.swapInterval()); + tlw->windowHandle()->setFormat(tlwFormat); + } + if (requestedFormat.swapBehavior() != tlwFormat.swapBehavior()) { + tlwFormat.setSwapBehavior(requestedFormat.swapBehavior()); + tlw->windowHandle()->setFormat(tlwFormat); + } } // The top-level window's surface is not good enough since it causes way too |