From 8155d0693f596c6b73d0acd977d5077dd7a6e6ea Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 13 Jul 2019 14:31:36 +0200 Subject: [PATCH] Eradicate Q_FOREACH in the WASM plugin and mark the plugin free of them The first one is trivially correct: it clearly doesn't modify the container under iteration. The second is a bit more subtle, because drawWindow() could be expected to call a paintEvent and this could theoretically lead to lowering, closing, or opening of a window. But this function just ends up blit()ting, so it doesn't call into user code. Change-Id: Id15e0102e9c8aa12516af27d771104e9993c48a1 Reviewed-by: Volker Hilsheimer Reviewed-by: Lorn Potter --- src/plugins/platforms/wasm/qwasmcompositor.cpp | 4 ++-- src/plugins/platforms/wasm/wasm.pro | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wasm/qwasmcompositor.cpp b/src/plugins/platforms/wasm/qwasmcompositor.cpp index 6d211667be..a810880c43 100644 --- a/src/plugins/platforms/wasm/qwasmcompositor.cpp +++ b/src/plugins/platforms/wasm/qwasmcompositor.cpp @@ -681,7 +681,7 @@ void QWasmCompositor::frame() QWasmWindow *someWindow = nullptr; - foreach (QWasmWindow *window, m_windowStack) { + for (QWasmWindow *window : qAsConst(m_windowStack)) { if (window->window()->surfaceClass() == QSurface::Window && qt_window_private(static_cast(window->window()))->receivedExpose) { someWindow = window; @@ -715,7 +715,7 @@ void QWasmCompositor::frame() m_blitter->bind(); m_blitter->setRedBlueSwizzle(true); - foreach (QWasmWindow *window, m_windowStack) { + for (QWasmWindow *window : qAsConst(m_windowStack)) { QWasmCompositedWindow &compositedWindow = m_compositedWindows[window]; if (!compositedWindow.visible) diff --git a/src/plugins/platforms/wasm/wasm.pro b/src/plugins/platforms/wasm/wasm.pro index c28df8f893..f8c8175525 100644 --- a/src/plugins/platforms/wasm/wasm.pro +++ b/src/plugins/platforms/wasm/wasm.pro @@ -7,6 +7,8 @@ QT += \ # Avoid X11 header collision, use generic EGL native types DEFINES += QT_EGL_NO_X11 +DEFINES += QT_NO_FOREACH + SOURCES = \ main.cpp \ qwasmintegration.cpp \