fix: handle surface null case in setOutputs#608
Merged
zccrs merged 1 commit intolinuxdeepin:develop/splash-screenfrom Oct 29, 2025
Merged
fix: handle surface null case in setOutputs#608zccrs merged 1 commit intolinuxdeepin:develop/splash-screenfrom
zccrs merged 1 commit intolinuxdeepin:develop/splash-screenfrom
Conversation
1. Added null check for surface() in setOutputs method to prevent crashes when surface is null 2. Added prelaunch outputs storage to preserve output settings during surface initialization phase 3. Applied prelaunch outputs when converting to normal surface to ensure proper output assignment 4. This fixes a race condition where WSurface could be null while WXWaylandSurface still exists Influence: 1. Test surface creation and output assignment during prelaunch phase 2. Verify that surfaces properly inherit output settings when converted to normal surfaces 3. Test edge cases where surfaces might be destroyed while operations are pending 4. Validate that no crashes occur when setting outputs on null surfaces fix: 修复 setOutputs 中 surface 为 null 的情况处理 1. 在 setOutputs 方法中添加了对 surface() 的空检查,防止 surface 为 null 时崩溃 2. 添加了预启动输出存储功能,在 surface 初始化阶段保留输出设置 3. 在转换为普通 surface 时应用预启动输出,确保正确的输出分配 4. 修复了 WSurface 可能为 null 而 WXWaylandSurface 仍存在的竞态条件 Influence: 1. 测试预启动阶段的 surface 创建和输出分配 2. 验证 surface 转换为普通 surface 时是否正确继承输出设置 3. 测试 surface 可能被销毁而操作仍在挂起的边缘情况 4. 确认在 null surface 上设置输出时不会发生崩溃
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR refactors the output assignment logic to safely buffer outputs during the prelaunch phase and apply them once the surface is fully initialized, while adding a guard to prevent crashes when surface() is null, fixing a race condition between WXWaylandSurface and WSurface. Sequence diagram for output assignment during prelaunch and surface initializationsequenceDiagram
participant Client
participant SurfaceWrapper
participant WSurface
participant WOutput
Client->>SurfaceWrapper: setOutputs(outputs) (prelaunch phase)
SurfaceWrapper->>SurfaceWrapper: Store outputs in m_prelaunchOutputs
Note over SurfaceWrapper: surface() is null, outputs buffered
Client->>SurfaceWrapper: convertToNormalSurface()
SurfaceWrapper->>SurfaceWrapper: setup()
SurfaceWrapper->>SurfaceWrapper: Apply m_prelaunchOutputs via setOutputs()
SurfaceWrapper->>WSurface: setOutputs(outputs)
WSurface->>WOutput: Assign outputs
SurfaceWrapper->>SurfaceWrapper: Clear m_prelaunchOutputs
Class diagram for updated SurfaceWrapper output handlingclassDiagram
class SurfaceWrapper {
+QList<WOutput*> m_prelaunchOutputs
+void setOutputs(const QList<WOutput*>& outputs)
+void convertToNormalSurface(WToplevelSurface* shellSurface, Type type)
}
class WSurface {
+QList<WOutput*> outputs()
}
class WOutput
SurfaceWrapper --> WSurface : surface()
SurfaceWrapper --> WOutput : m_prelaunchOutputs
SurfaceWrapper ..> WToplevelSurface : convertToNormalSurface()
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
zccrs
approved these changes
Oct 29, 2025
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: wineee, zccrs 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 |
8c7eb86
into
linuxdeepin:develop/splash-screen
6 of 10 checks passed
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.
crashes when surface is null
surface initialization phase
proper output assignment
WXWaylandSurface still exists
Influence:
to normal surfaces
are pending
fix: 修复 setOutputs 中 surface 为 null 的情况处理
时崩溃
Influence:
Summary by Sourcery
Add null-safe handling and prelaunch output caching in SurfaceWrapper to prevent crashes and ensure correct output assignment when surfaces initialize.
Bug Fixes:
Enhancements: