Skip to content

Commit

Permalink
tst_QTextLayout: compile with QT_NO_FOREACH
Browse files Browse the repository at this point in the history
The container is local, and it's not changed in the loop body; port to
ranged-for and use std::as_const.

Task-number: QTBUG-115839
Change-Id: If4d46f55e7aae8c87f6d7b3c4e78da7e51e128c0
Reviewed-by: Marc Mutz <[email protected]>
  • Loading branch information
Ahmad Samir committed Jan 3, 2025
1 parent 56d2a65 commit 25fcb41
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses

/*
!!!!!! Warning !!!!!
Please don't save this file in emacs. It contains utf8 text sequences emacs will
Expand Down Expand Up @@ -2466,7 +2464,7 @@ void tst_QTextLayout::superscriptCrash_qtbug53911()
}

// This loop would crash before fix for QTBUG-53911
foreach (QTextLayout *textLayout, textLayouts) {
for (QTextLayout *textLayout : std::as_const(textLayouts)) {
textLayout->beginLayout();
while (textLayout->createLine().isValid());
textLayout->endLayout();
Expand Down

0 comments on commit 25fcb41

Please sign in to comment.