forked from qt-creator/qt-creator
TreeScanner: Pass a copy of filter and factory into async call
Otherwise, m_filter and m_factory may be used from 2 threads at the same time, what is not thread safe (setFilter() / setTypeFactory() from caller thread, and copy of m_filter and m_factory inside async call body). Change-Id: Ic322870f9c27de10c5c51082cfbb85c729326993 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -45,8 +45,9 @@ bool TreeScanner::asyncScanForFiles(const Utils::FilePath &directory)
|
||||
if (!m_futureWatcher.isFinished())
|
||||
return false;
|
||||
|
||||
m_scanFuture = Utils::runAsync([this, directory](FutureInterface &fi) {
|
||||
TreeScanner::scanForFiles(fi, directory, m_filter, m_factory);
|
||||
m_scanFuture = Utils::runAsync(
|
||||
[directory, filter = m_filter, factory = m_factory] (FutureInterface &fi) {
|
||||
TreeScanner::scanForFiles(fi, directory, filter, factory);
|
||||
});
|
||||
m_futureWatcher.setFuture(m_scanFuture);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user