Commit 3c978830 authored by Sebastian Engel's avatar Sebastian Engel

Prevent possible Qt container detachment

clang analyzer detected a location where a QList element could be
detached. Following the example of KFileMetaData, qAsConst now
prevents detachment.

Reference:
https://invent.kde.org/frameworks/kfilemetadata/-/blob/master/tests/dump.cpp#L45
parent 423b0a36
......@@ -1451,8 +1451,9 @@ QMap<QString, QString> FileContent::toolTipInfos()
MetaDataExtractionResult result(fullPath(), mime.name());
KFileMetaData::ExtractorCollection extractorCollection;
QList<KFileMetaData::Extractor*> exList = extractorCollection.fetchExtractors(mime.name());
for (KFileMetaData::Extractor *ex : extractorCollection.fetchExtractors(mime.name())) {
for (KFileMetaData::Extractor *ex : qAsConst(exList)) {
ex->extract(&result);
const auto groups = result.preferredGroups();
DEBUG_WIN << "Metadata Extractor result has " << QString::number(groups.count()) << " groups";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment