From 7911a4f0480e3e5371515f211601b69606e32d50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCri=20Valdmann?= Date: Mon, 13 Nov 2017 12:49:02 +0100 Subject: Fix thread synchronization issue in tst_qwebengineprofile Change-Id: I7b7c4a6501387b1d657e55f222908365990b8fef Reviewed-by: Allan Sandfeld Jensen --- tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp index 6961f3b6d..c443ee114 100644 --- a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp +++ b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp @@ -200,9 +200,13 @@ public: } bool isSequential() const override { return true; } qint64 bytesAvailable() const override - { return m_bytesAvailable; } + { + QMutexLocker lock(&m_mutex); + return m_bytesAvailable; + } bool atEnd() const override { + QMutexLocker lock(&m_mutex); return (m_data.size() >= 1000 && m_bytesRead >= 1000); } protected: @@ -237,7 +241,7 @@ protected: } private: - QMutex m_mutex; + mutable QMutex m_mutex{QMutex::Recursive}; QByteArray m_data; QBasicTimer m_timer; int m_bytesRead; -- cgit v1.2.3