diff options
author | Albert Astals Cid <aacid@kde.org> | 2020-08-29 12:30:34 +0200 |
---|---|---|
committer | Albert Astals Cid <aacid@kde.org> | 2020-08-29 12:31:01 +0200 |
commit | a9fc7f0bcdcece62eda698016064a5f9e3acea24 (patch) | |
tree | 404b2907e9404b00e0f120a16b32bf36f3c49ef0 | |
parent | 418a9373616c14e67a1f9792d4039e62c3f8feb9 (diff) |
qt6: workaround QTBUG-86318
-rw-r--r-- | qt6/tests/stress-threads-qt6.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/qt6/tests/stress-threads-qt6.cpp b/qt6/tests/stress-threads-qt6.cpp index 162bb9e5..3803fd06 100644 --- a/qt6/tests/stress-threads-qt6.cpp +++ b/qt6/tests/stress-threads-qt6.cpp @@ -182,11 +182,13 @@ void CrazyThread::run() if (!annotations.isEmpty()) { qDebug() << "modify annotation..."; - annotations.at(QRandomGenerator::global()->bounded(annotations.size()))->setBoundary(QRectF(0.5, 0.5, 0.25, 0.25)); - annotations.at(QRandomGenerator::global()->bounded(annotations.size()))->setAuthor(QStringLiteral("foo")); - annotations.at(QRandomGenerator::global()->bounded(annotations.size()))->setContents(QStringLiteral("bar")); - annotations.at(QRandomGenerator::global()->bounded(annotations.size()))->setCreationDate(QDateTime::currentDateTime()); - annotations.at(QRandomGenerator::global()->bounded(annotations.size()))->setModificationDate(QDateTime::currentDateTime()); + // size is now a qsizetype which confuses bounded(), pretend we will never have that many annotations anyway + const quint32 annotationsSize = annotations.size(); + annotations.at(QRandomGenerator::global()->bounded(annotationsSize))->setBoundary(QRectF(0.5, 0.5, 0.25, 0.25)); + annotations.at(QRandomGenerator::global()->bounded(annotationsSize))->setAuthor(QStringLiteral("foo")); + annotations.at(QRandomGenerator::global()->bounded(annotationsSize))->setContents(QStringLiteral("bar")); + annotations.at(QRandomGenerator::global()->bounded(annotationsSize))->setCreationDate(QDateTime::currentDateTime()); + annotations.at(QRandomGenerator::global()->bounded(annotationsSize))->setModificationDate(QDateTime::currentDateTime()); } qDeleteAll(annotations); @@ -208,7 +210,9 @@ void CrazyThread::run() if (!annotations.isEmpty()) { qDebug() << "remove annotation..."; - page->removeAnnotation(annotations.takeAt(QRandomGenerator::global()->bounded(annotations.size()))); + // size is now a qsizetype which confuses bounded(), pretend we will never have that many annotations anyway + const quint32 annotationsSize = annotations.size(); + page->removeAnnotation(annotations.takeAt(QRandomGenerator::global()->bounded(annotationsSize))); } qDeleteAll(annotations); |