diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com> | 2015-01-14 13:09:29 +0100 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com> | 2015-01-23 14:24:24 +0100 |
commit | c27e1f498f933406aebc1334482da6761fe6de8c (patch) | |
tree | 9250685021cbc0fc6d3ca36598a650e71cda8e1a /src/plugins/platforms/android/qandroidplatformscreen.cpp | |
parent | e58a721c5de90208ba544c84ecd1b83d0544dfd8 (diff) |
Android: Fix crash in QCompleter test
The call to QPlatformWindow::setVisible() will trigger flushing
of the window system events. Depending on the events, this could
lead to the window being hidden. Since platformScreen()->addWindow()
and removeWindow() was done *after* this flush, you could get the
remove for a window before it had been added, whereas the logic
in these functions were written under the assumption that there
is exactly one remove per add, and that add always precedes the
remove.
This has only been seen when running the QCompleter test so far.
This patch reorders the statements to make sure the events are flushed
after the window stack has been updated. In addition, it adds asserts
for the assumptions in the addWindow/removeWindow code to catch bugs
there earlier.
Change-Id: Ic67b03afbf7acbcb78be86bffa4c26360dc5832f
Task-number: QTBUG-43836
Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/android/qandroidplatformscreen.cpp')
-rw-r--r-- | src/plugins/platforms/android/qandroidplatformscreen.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/plugins/platforms/android/qandroidplatformscreen.cpp b/src/plugins/platforms/android/qandroidplatformscreen.cpp index a4e82a29ef..41139941c8 100644 --- a/src/plugins/platforms/android/qandroidplatformscreen.cpp +++ b/src/plugins/platforms/android/qandroidplatformscreen.cpp @@ -131,6 +131,7 @@ void QAndroidPlatformScreen::addWindow(QAndroidPlatformWindow *window) if (window->parent() && window->isRaster()) return; + Q_ASSERT(!m_windowStack.contains(window)); m_windowStack.prepend(window); if (window->isRaster()) { m_rasterSurfaces.ref(); @@ -147,7 +148,10 @@ void QAndroidPlatformScreen::removeWindow(QAndroidPlatformWindow *window) if (window->parent() && window->isRaster()) return; + + Q_ASSERT(m_windowStack.contains(window)); m_windowStack.removeOne(window); + Q_ASSERT(!m_windowStack.contains(window)); if (window->isRaster()) { m_rasterSurfaces.deref(); |