summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>2016-02-01 01:23:54 +0100
committerTor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>2016-02-02 02:12:26 +0000
commitd10bfff89ae103d84a2438d9b8bc6e55ba3b122d (patch)
tree48d7e57ba9dc01561e2ea5e4809b45674f2afae8 /src
parented2e15780385f7cf0a0d3aedc9cb2059d470bd58 (diff)
Revert "QWindow::destroy(): only reset QGuiApp::focus_window and friends as a last resort"
This reverts commit 4c71db756741d35ccb32dc4c32aa1823264c85df. It's too risky for 5.6, we should let it cook in dev for a while and backport when ready. Change-Id: I91e677e65d967f29c84a254cd3dffc8bb847b263 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qplatformwindow.cpp2
-rw-r--r--src/gui/kernel/qwindow.cpp46
-rw-r--r--src/widgets/accessible/qaccessiblewidgetfactory.cpp9
3 files changed, 11 insertions, 46 deletions
diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp
index fd3ce40342..aea029b7f5 100644
--- a/src/gui/kernel/qplatformwindow.cpp
+++ b/src/gui/kernel/qplatformwindow.cpp
@@ -62,8 +62,6 @@ QPlatformWindow::QPlatformWindow(QWindow *window)
*/
QPlatformWindow::~QPlatformWindow()
{
- // We don't flush window system events here, as the event will be
- // delivered with a platform window that is half-way destroyed.
}
/*!
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 11ae3aa5c7..21734f1619 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -1648,6 +1648,15 @@ void QWindow::destroy()
}
}
+ if (QGuiApplicationPrivate::focus_window == this)
+ QGuiApplicationPrivate::focus_window = parent();
+ if (QGuiApplicationPrivate::currentMouseWindow == this)
+ QGuiApplicationPrivate::currentMouseWindow = parent();
+ if (QGuiApplicationPrivate::currentMousePressWindow == this)
+ QGuiApplicationPrivate::currentMousePressWindow = parent();
+ if (QGuiApplicationPrivate::tabletPressTarget == this)
+ QGuiApplicationPrivate::tabletPressTarget = parent();
+
bool wasVisible = isVisible();
d->visibilityOnDestroy = wasVisible && d->platformWindow;
@@ -1656,44 +1665,11 @@ void QWindow::destroy()
QPlatformSurfaceEvent e(QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed);
QGuiApplication::sendEvent(this, &e);
- QPlatformWindow *platformWindow = d->platformWindow;
- d->platformWindow = 0;
-
- // We flush before deleting the platform window so that any pending activation
- // events for the window will be delivered.
- QWindowSystemInterface::flushWindowSystemEvents();
-
- delete platformWindow;
-
- // Then we flush again so that if the platform plugin sent any deactivation
- // events as a result of being destroyed, we can pick that up by looking at
- // QGuiApplicationPrivate::focus_window, which will be up to date.
- QWindowSystemInterface::flushWindowSystemEvents();
-
+ delete d->platformWindow;
d->resizeEventPending = true;
d->receivedExpose = false;
d->exposed = false;
-
- // Ensure Qt doesn't refer to a destroyed QWindow if the platform plugin
- // didn't reset the window activation or other states as part of setVisible
- // or its destruction. We make a best guess of transferring to the parent
- // window, as this is what most window managers will do. We go through the
- // QWindowSystemInterface so that the proper signals and events are sent
- // as a result of the reset.
- if (QGuiApplicationPrivate::focus_window == this)
- QWindowSystemInterface::handleWindowActivated(parent());
- if (QGuiApplicationPrivate::currentMouseWindow == this)
- QWindowSystemInterface::handleEnterLeaveEvent(parent(), this);
-
- // FIXME: Handle these two though QPA like the others. Unfortunately both
- // processMouseEvent and processTabletEvent in QGuiApplication have conditions
- // that make sending the event though QPA not feasable right now.
- if (QGuiApplicationPrivate::currentMousePressWindow == this)
- QGuiApplicationPrivate::currentMousePressWindow = parent();
- if (QGuiApplicationPrivate::tabletPressTarget == this)
- QGuiApplicationPrivate::tabletPressTarget = parent();
-
- QWindowSystemInterface::flushWindowSystemEvents();
+ d->platformWindow = 0;
if (wasVisible)
d->maybeQuitOnLastWindowClosed();
diff --git a/src/widgets/accessible/qaccessiblewidgetfactory.cpp b/src/widgets/accessible/qaccessiblewidgetfactory.cpp
index 00e21da34d..4fa7c89482 100644
--- a/src/widgets/accessible/qaccessiblewidgetfactory.cpp
+++ b/src/widgets/accessible/qaccessiblewidgetfactory.cpp
@@ -43,7 +43,6 @@
#include <qtreeview.h>
#include <qvariant.h>
#include <qaccessible.h>
-#include <private/qwidget_p.h>
#ifndef QT_NO_ACCESSIBILITY
@@ -54,15 +53,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
QAccessibleInterface *iface = 0;
if (!object || !object->isWidgetType())
return iface;
-
- // QWidget emits destroyed() from its destructor instead of letting the QObject
- // destructor do it, which means the QWidget is unregistered from the accessibillity
- // cache. But QWidget destruction also emits enter and leave events, which may end
- // up here, so we have to ensure that we don't fill the cache with an entry of
- // a widget that is going away.
QWidget *widget = static_cast<QWidget*>(object);
- if (QWidgetPrivate::get(widget)->data.in_destructor)
- return iface;
if (false) {
#ifndef QT_NO_LINEEDIT