Fix: [file-enumerator] use g_file_enumerator_next_file()#260
Conversation
5f38fab to
5cbbb8b
Compare
--Replace use of g_file_enumerator_iterate() with g_file_enumerator_next_file()
in DEnumerator::hasNext() so the enumerator's internal cursor is advanced by
GIO and error/end conditions are handled unambiguously.
--Using g_file_enumerator_next_file() yields clearer semantics: non-NULL -> next entry,
NULL + NULL error -> end, NULL + non-NULL error -> error. This avoids premature termination
caused by backend-specific iterate() quirks.
--Construct next entry URL via the existing buildUrl(...) helper and preserve
existing logic that creates the DFileInfo from the returned GFileInfo. Preserve
existing error handling and d->checkFilter() behavior and recursive skipping of filtered entries.
--Fix URL construction so joining directory path and filename does not introduce
an extra '/' (previously produced e.g. .../vault_unlocked//file). The logic now
concatenates carefully (handles root path and trailing slashes) to avoid duplicate separators.
Log: fix issue
Bug: https://pms.uniontech.com//bug-view-351177.html
5cbbb8b to
7c4dfa5
Compare
deepin pr auto review这段代码主要对 1. 语法逻辑
2. 代码质量
3. 代码性能
4. 代码安全
总结与改进建议代码整体质量很高,修复了旧版本中的逻辑漏洞和严重 Bug。 建议修改点: 针对 // nextInfo == NULL: either finished or an error occurred
if (gerror) {
d->setErrorFromGError(gerror);
// 发生错误时,清空状态并停止迭代。
// 返回 false 表示没有下一个元素了,调用者应检查 error()。
d->nextUrl = QUrl();
d->dfileInfoNext.reset();
return false;
}理由: |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: GongHeng2017, Johnson-zs, liyigang1 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Log: fix issue
Bug: https://pms.uniontech.com//bug-view-351177.html