Fix infinite loop when iterating content uri sub-files/dirs
make QAbstractFileEngineIterator::currentFilePath() virtual and implement it under AndroidContentFileEngine to return current fileName because content uris shouldn't be constructed manaully like normal file paths. Pick-to: 6.4 6.2 Fixes: QTBUG-104776 Change-Id: I4643a73a3bd4019bedaa056c35468117bcec18dc Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
This commit is contained in:
parent
2f440169c0
commit
f3c998510d
@ -206,7 +206,7 @@ public:
|
||||
|
||||
virtual QString currentFileName() const = 0;
|
||||
virtual QFileInfo currentFileInfo() const;
|
||||
QString currentFilePath() const;
|
||||
virtual QString currentFilePath() const;
|
||||
|
||||
protected:
|
||||
enum EntryInfoType {
|
||||
|
@ -200,3 +200,8 @@ QString AndroidContentFileEngineIterator::currentFileName() const
|
||||
return QString();
|
||||
return m_entries.at(m_index - 1);
|
||||
}
|
||||
|
||||
QString AndroidContentFileEngineIterator::currentFilePath() const
|
||||
{
|
||||
return currentFileName();
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ public:
|
||||
QString next() override;
|
||||
bool hasNext() const override;
|
||||
QString currentFileName() const override;
|
||||
QString currentFilePath() const override;
|
||||
private:
|
||||
mutable QStringList m_entries;
|
||||
mutable int m_index = -1;
|
||||
|
@ -186,7 +186,7 @@ public:
|
||||
return m_currentIterator->currentFileName();
|
||||
}
|
||||
|
||||
virtual QString currentFilePath() const
|
||||
QString currentFilePath() const override
|
||||
{
|
||||
if (!m_currentIterator)
|
||||
return {};
|
||||
|
Loading…
Reference in New Issue
Block a user