sync: from linuxdeepin/dde-session-shell#498
Merged
yixinshark merged 1 commit intomasterfrom Apr 15, 2026
Merged
Conversation
There was a problem hiding this comment.
Sorry @deepin-ci-robot, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
Synchronize source files from linuxdeepin/dde-session-shell. Source-pull-request: linuxdeepin/dde-session-shell#64
bf3faa8 to
bd91fa5
Compare
yixinshark
approved these changes
Apr 15, 2026
Contributor
Author
deepin pr auto review这段代码主要涉及对壁纸服务 1. 语法逻辑
2. 代码质量
3. 代码性能
4. 代码安全
改进建议
优化后的代码示例bool FullScreenBackground::getScaledBlurImage(const QString &originPath, QString &scaledPath)
{
// 壁纸服务dde-wallpaper-cache
QDBusInterface wallpaperCacheInterface("org.deepin.dde.WallpaperCache", "/org/deepin/dde/WallpaperCache",
"org.deepin.dde.WallpaperCache", QDBusConnection::systemBus());
if (!wallpaperCacheInterface.isValid()) {
qWarning() << "dde-wallpaper-cache service not existed";
return false;
}
QFile file(originPath);
if (!file.open(QIODevice::ReadOnly)) {
qWarning() << "open origin file failed:" << originPath;
return false;
}
// 显式关闭文件句柄,避免资源泄漏
file.close();
QDBusReply<QStringList> pathList = wallpaperCacheInterface.call("RequestBlurImage", originPath);
if (!pathList.isValid()) {
qWarning() << "call RequestBlurImage failed:" << pathList.error().message();
return false;
}
QString path = pathList.value().at(0);
if (!path.isEmpty() && path != originPath) {
scaledPath = path;
}
return true;
}总结这段代码的改进方向是正确的,尤其是在文件句柄管理和条件编译逻辑上。通过统一服务检测方式和增强错误处理,可以进一步提升代码的健壮性和可维护性。 |
Contributor
Author
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: deepin-ci-robot, yixinshark 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Synchronize source files from linuxdeepin/dde-session-shell.
Source-pull-request: linuxdeepin/dde-session-shell#64