QmlDesigner: Fix flacky test AsynchronousImageCache.WaitForFinished

Change-Id: I94afa8ec2925b85f5dbf44e7b2ad5db484f48148
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Marco Bubke
2021-01-27 14:13:42 +01:00
parent 6a0cfc0c6e
commit 62582877f6
3 changed files with 10 additions and 4 deletions

View File

@@ -158,8 +158,8 @@ std::tuple<bool, AsynchronousImageCache::Entry> AsynchronousImageCache::getEntry
if (m_entries.empty())
return {false, Entry{}};
Entry entry = m_entries.back();
m_entries.pop_back();
Entry entry = m_entries.front();
m_entries.pop_front();
return {true, entry};
}

View File

@@ -28,6 +28,7 @@
#include "asynchronousimagecacheinterface.h"
#include <condition_variable>
#include <deque>
#include <functional>
#include <mutex>
#include <thread>
@@ -117,7 +118,7 @@ private:
void wait();
private:
std::vector<Entry> m_entries;
std::deque<Entry> m_entries;
mutable std::mutex m_mutex;
std::condition_variable m_condition;
std::thread m_backgroundThread;