summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2015-11-27 08:35:45 +0100
committerLiang Qi <liang.qi@theqtcompany.com>2015-11-27 08:35:45 +0100
commit8c57e8c012d1045f2bdb30d376625a32c33fdfc4 (patch)
tree33cdd83e82fd59aa4b750f3e2dda3c445cd37abf /src/widgets
parentb13801fd550d4eef2e45ac3e11304571e0146dd9 (diff)
parentc83eefff976a5f2cd673f6b4a95922b13855dd29 (diff)
Merge remote-tracking branch 'origin/5.5' into 5.6
Conflicts: src/network/socket/qnativesocketengine_p.h src/network/ssl/qsslsocket_mac.cpp src/network/ssl/qsslsocket_mac_p.h src/widgets/kernel/qwidget.cpp Change-Id: I39592cb37d710dfaf8640769ba3c1b637927d7f4
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp2
-rw-r--r--src/widgets/kernel/qapplication.cpp6
-rw-r--r--src/widgets/kernel/qwidget.cpp46
3 files changed, 41 insertions, 13 deletions
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index cd26a6759f..e62fab6f08 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -1971,6 +1971,8 @@ void QFileDialog::setIconProvider(QFileIconProvider *provider)
QFileIconProvider *QFileDialog::iconProvider() const
{
Q_D(const QFileDialog);
+ if (!d->model)
+ return Q_NULLPTR;
return d->model->iconProvider();
}
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 29bff8227f..4f13c06c15 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -2241,8 +2241,10 @@ void QApplicationPrivate::notifyActiveWindowChange(QWindow *previous)
QApplication::setActiveWindow(tlw);
// QTBUG-37126, Active X controls may set the focus on native child widgets.
if (wnd && tlw && wnd != tlw->windowHandle()) {
- if (QWidgetWindow *widgetWindow = qobject_cast<QWidgetWindow *>(wnd))
- widgetWindow->widget()->setFocus(Qt::ActiveWindowFocusReason);
+ if (QWidgetWindow *widgetWindow = qobject_cast<QWidgetWindow *>(wnd)) {
+ if (widgetWindow->widget()->inherits("QAxHostWidget"))
+ widgetWindow->widget()->setFocus(Qt::ActiveWindowFocusReason);
+ }
}
}
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 94099aac7a..b8b8640cea 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -73,6 +73,7 @@
#include <QtGui/qinputmethod.h>
#include <QtGui/qopenglcontext.h>
#include <QtGui/private/qopenglcontext_p.h>
+#include <QtGui/qoffscreensurface.h>
#include <private/qgraphicseffect_p.h>
#include <qbackingstore.h>
@@ -1822,26 +1823,49 @@ void QWidgetPrivate::deleteSysExtra()
{
}
+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, since the platform bs does not have a reference
- // to the widget.
+ // make the context current here. This is taken care of by deleteBackingStore().
-#ifndef QT_NO_OPENGL
- if (textureChildSeen && extra->topextra->shareContext)
- extra->topextra->shareContext->makeCurrent(extra->topextra->window);
-#endif
extra->topextra->backingStoreTracker.destroy();
- delete extra->topextra->backingStore;
- extra->topextra->backingStore = 0;
+ deleteBackingStore(this);
#ifndef QT_NO_OPENGL
qDeleteAll(extra->topextra->widgetTextures);
extra->topextra->widgetTextures.clear();
- if (textureChildSeen && extra->topextra->shareContext)
- extra->topextra->shareContext->doneCurrent();
delete extra->topextra->shareContext;
extra->topextra->shareContext = 0;
#endif
@@ -12013,7 +12037,7 @@ void QWidget::setBackingStore(QBackingStore *store)
return;
QBackingStore *oldStore = topData->backingStore;
- delete topData->backingStore;
+ deleteBackingStore(d);
topData->backingStore = store;
QWidgetBackingStore *bs = d->maybeBackingStore();