fix: avoid duplicate GRUB background preview refresh - #1201
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 52cyb 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 |
Reviewer's GuideThe PR refactors GRUB background export to use a stable runtime path with atomic replacement, avoids duplicate preview refreshes, and introduces synchronization to prevent concurrent exports and redundant updates. Sequence diagram for GRUB background export with stable pathsequenceDiagram
actor Client
participant Theme
participant exportBackground
participant Filesystem
Client->>Theme: GetBackground(sender)
Theme->>Theme: backgroundExportMu.Lock()
Theme->>exportBackground: exportBackground(background, grubBackgroundRuntimeDir)
exportBackground->>Filesystem: os.Open(source)
exportBackground->>Filesystem: os.CreateTemp(destinationDir, pattern)
exportBackground->>Filesystem: io.Copy(tempFile, sourceFile)
exportBackground->>Filesystem: tempFile.Chmod(0644)
exportBackground->>Filesystem: os.Rename(tempPath, destination)
exportBackground-->>Theme: destination
Theme->>Theme: backgroundExportMu.Unlock()
Theme-->>Client: destination
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
1. Add a revision property for refreshing background content at a stable path 2. Avoid emitting path changes when the background path remains unchanged 3. Refresh the preview only after a pending background update completes 4. Restrict automatic theme enabling to control-center initiated updates 5. Replace timestamp-based cache busting with an explicit revision Log: Avoid duplicate flickering when refreshing the GRUB background preview Influence: 1. Verify changing the background refreshes the preview once 2. Verify changing the background while the theme is disabled enables it 3. Verify opening the boot menu page does not trigger duplicate refreshes 4. Verify repeated reads of the same background path do not cause flickering 5. Verify the updated image is loaded when the exported path stays unchanged fix: 避免 GRUB 背景预览重复刷新 1. 增加背景版本属性,用于刷新固定路径下的图片内容 2. 背景路径未变化时不再发送路径变化信号 3. 仅在待处理的背景修改完成后刷新预览 4. 仅对控制中心发起的背景修改自动开启主题 5. 使用显式版本号替代时间戳刷新图片缓存 Log: 避免刷新 GRUB 背景预览时出现两次闪烁 Influence: 1. 验证修改背景后预览只刷新一次 2. 验证主题关闭时修改背景可以正常开启主题 3. 验证打开启动菜单页面不会触发重复刷新 4. 验证重复读取相同背景路径不会造成闪烁 5. 验证导出路径不变时仍能加载更新后的图片 PMS: BUG-371485
deepin pr auto review★ 总体评分:100分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 --- a/grub2/theme_ifc.go
+++ b/grub2/theme_ifc.go
@@ -88,6 +88,9 @@ func exportBackground(source, destinationDir string) (string, error) {
sourceFile, err := os.Open(source)
if err != nil {
return "", err
}
+ if err := os.MkdirAll(destinationDir, 0755); err != nil {
+ return "", err
+ }
defer sourceFile.Close()
ext := filepath.Ext(source) |
Log: Avoid duplicate flickering when refreshing the GRUB background preview
Influence:
fix: 避免 GRUB 背景预览重复刷新
Log: 避免刷新 GRUB 背景预览时出现两次闪烁
Influence:
PMS: BUG-371485
Summary by Sourcery
Stabilize GRUB background export to avoid duplicate preview refreshes and flickering.
Enhancements: