diff options
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 26 | ||||
-rw-r--r-- | src/widgets/kernel/qwidgetbackingstore.cpp | 6 | ||||
-rw-r--r-- | src/widgets/kernel/qwidgetwindow.cpp | 8 |
3 files changed, 11 insertions, 29 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index be9287d39b..a7258d8f7e 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1876,39 +1876,15 @@ static void deleteBackingStore(QWidgetPrivate *d) { QTLWExtra *topData = d->topData(); - // The context must be current when destroying the backing store as it may attempt to - // release resources like textures and shader programs. The window may not be suitable - // anymore as there will often not be a platform window underneath at this stage. Fall - // back to a QOffscreenSurface in this case. - QScopedPointer<QOffscreenSurface> tempSurface; -#ifndef QT_NO_OPENGL - if (d->textureChildSeen && topData->shareContext) { - if (topData->window->handle()) { - topData->shareContext->makeCurrent(topData->window); - } else { - tempSurface.reset(new QOffscreenSurface); - tempSurface->setFormat(topData->shareContext->format()); - tempSurface->create(); - topData->shareContext->makeCurrent(tempSurface.data()); - } - } -#endif - delete topData->backingStore; topData->backingStore = 0; - -#ifndef QT_NO_OPENGL - if (d->textureChildSeen && topData->shareContext) - topData->shareContext->doneCurrent(); -#endif } void QWidgetPrivate::deleteTLSysExtra() { if (extra && extra->topextra) { //the qplatformbackingstore may hold a reference to the window, so the backingstore - //needs to be deleted first. If the backingstore holds GL resources, we need to - // make the context current here. This is taken care of by deleteBackingStore(). + //needs to be deleted first. extra->topextra->backingStoreTracker.destroy(); deleteBackingStore(this); diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp index bb421927db..52080fe05f 100644 --- a/src/widgets/kernel/qwidgetbackingstore.cpp +++ b/src/widgets/kernel/qwidgetbackingstore.cpp @@ -143,10 +143,8 @@ void QWidgetBackingStore::qt_flush(QWidget *widget, const QRegion ®ion, QBack // WA_TranslucentBackground. Therefore the compositor needs to know whether the app intends // to rely on translucency, in order to decide if it should clear to transparent or opaque. const bool translucentBackground = widget->testAttribute(Qt::WA_TranslucentBackground); - // Use the tlw's context, not widget's. The difference is important with native child - // widgets where tlw != widget. - backingStore->handle()->composeAndFlush(widget->windowHandle(), effectiveRegion, offset, widgetTextures, - tlw->d_func()->shareContext(), translucentBackground); + backingStore->handle()->composeAndFlush(widget->windowHandle(), effectiveRegion, offset, + widgetTextures, translucentBackground); widget->window()->d_func()->sendComposeStatus(widget->window(), true); } else #endif diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index d30154410c..319eccf223 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -96,6 +96,7 @@ public: } QRectF closestAcceptableGeometry(const QRectF &rect) const Q_DECL_OVERRIDE; + QOpenGLContext *shareContext() const override; }; QRectF QWidgetWindowPrivate::closestAcceptableGeometry(const QRectF &rect) const @@ -127,6 +128,13 @@ QRectF QWidgetWindowPrivate::closestAcceptableGeometry(const QRectF &rect) const return result; } +QOpenGLContext *QWidgetWindowPrivate::shareContext() const +{ + Q_Q(const QWidgetWindow); + const QWidgetPrivate *widgetPrivate = QWidgetPrivate::get(q->widget()); + return widgetPrivate->shareContext(); +} + QWidgetWindow::QWidgetWindow(QWidget *widget) : QWindow(*new QWidgetWindowPrivate(), 0) , m_widget(widget) |