From 57a7efe4ddc66a202334a0391ab088efb518fc4b Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 12 Jul 2023 08:48:19 +0200 Subject: [PATCH] eglfs plugin: port away from Q_FOREACH Mark the module are Q_FOREACH-free, so it stays that way. These two instances are risk-free, because the loop is over local variables that the loop bodies clearly do not touch, so the safety copy that Q_FOREACH takes is not required here. Change-Id: Ida3c1d51c661d77a59a2ad105e080c3c9b66c53f Reviewed-by: Shawn Rutledge (cherry picked from commit c91146b9eff65cd8c860d26e09242795300a6b14) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/eglfs/CMakeLists.txt | 1 + src/plugins/platforms/eglfs/api/qeglfsintegration.cpp | 3 ++- src/plugins/platforms/eglfs/api/qeglfsscreen.cpp | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/eglfs/CMakeLists.txt b/src/plugins/platforms/eglfs/CMakeLists.txt index cebb0fe66e4..58c45e466a6 100644 --- a/src/plugins/platforms/eglfs/CMakeLists.txt +++ b/src/plugins/platforms/eglfs/CMakeLists.txt @@ -34,6 +34,7 @@ qt_internal_add_module(EglFSDeviceIntegrationPrivate DEFINES QT_BUILD_EGL_DEVICE_LIB QT_EGL_NO_X11 + QT_NO_FOREACH EGLFS_PREFERRED_PLUGIN=${QT_QPA_DEFAULT_EGLFS_INTEGRATION} INCLUDE_DIRECTORIES api diff --git a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp index 42cbdf127ce..aafe47ca524 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp @@ -110,7 +110,8 @@ void QEglFSIntegration::initialize() void QEglFSIntegration::destroy() { - foreach (QWindow *w, qGuiApp->topLevelWindows()) + const auto toplevels = qGuiApp->topLevelWindows(); + for (QWindow *w : toplevels) w->destroy(); qt_egl_device_integration()->screenDestroy(); diff --git a/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp index 72c4a47dbb4..c5108be04a7 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp @@ -189,7 +189,7 @@ QPixmap QEglFSScreen::grabWindow(WId wid, int x, int y, int width, int height) c return QPixmap::fromImage(img).copy(x, y, width, height); } - foreach (QOpenGLCompositorWindow *w, windows) { + for (QOpenGLCompositorWindow *w : windows) { const QWindow *window = w->sourceWindow(); if (window->winId() == wid) { const QRect geom = window->geometry();