🐞 Segfault when using asset catalog colors
还没有人认领这个 Issue。
评估
调研方向
从链接的 EditorThemeReproduction.zip 中的 ContentView.swift 开始,使用 asset catalog 中的 NSColor 值(尤其是 NSColor.editorBackground)复现启动时的 segfault。将失败的 EditorTheme 构造与正常工作的 usingColorSpace(.sRGB) 情况进行比较。当 asset catalog 颜色无需显式的色彩空间转换即可定义 EditorTheme,并且复现应用能够在没有 segfault 的情况下启动时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Description
When creating an EditorTheme from asset catalog colours, a segfault occurs at launch unless the background colour is explicitly cast to sRGB (NSColor.editorBackground.usingColorSpace(.sRGB)!).
To Reproduce
- Create a new SwiftUI macOS app
- Add CodeEditSourceEditor as a dependency
- Add sRGB colors sets to the Asset catalog
- Use those colors through NSColor to define an EditorTheme (e.g.
NSColor.editorBackground) - Launch the app
- Something segfaults
- If you set the background to
NSColor.editorBackground.usingColorSpace(.sRGB)!, it doesn't
Expected Behavior
It should be possible to use colours from the asset catalog to define the theme colours without additional hijinks.
Version Information
CodeEditSourceEditor: 0.15.2
macOS: 15.7.4
Xcode: 26.3
Additional Context
Minimal reproduction project: EditorThemeReproduction.zip (ContentView.swift contains all the relevant code.)
How I'm creating the theme (the asset catalog is included with the above project):
extension EditorTheme {
/// Creates an ``EditorTheme`` from colors defined in the asset catalog.
static func fromAssetCatalog() -> Self {
EditorTheme(
text: EditorTheme.Attribute(color: NSColor.editorText),
insertionPoint: NSColor.editorInsertionPoint,
invisibles: EditorTheme.Attribute(color: NSColor.editorInvisibles),
// This segfaults:
background: NSColor.editorBackground,
// This does not, despite the asset catalog color sets being defined as sRGB
// background: NSColor.editorBackground.usingColorSpace(.sRGB)!,
lineHighlight: NSColor.editorLineHighlight,
selection: NSColor.editorSelection,
keywords: EditorTheme.Attribute(
color: NSColor.editorKeywords,
bold: true
),
commands: EditorTheme.Attribute(color: NSColor.editorCommands),
types: EditorTheme.Attribute(color: NSColor.editorTypes),
attributes: EditorTheme.Attribute(color: NSColor.editorAttributes),
variables: EditorTheme.Attribute(color: NSColor.editorVariables),
values: EditorTheme.Attribute(color: NSColor.editorValues),
numbers: EditorTheme.Attribute(color: NSColor.editorNumbers),
strings: EditorTheme.Attribute(color: NSColor.editorStrings),
characters: EditorTheme.Attribute(color: NSColor.editorCharacters),
comments: EditorTheme.Attribute(color: NSColor.editorComments)
)
}
}
Screenshots
- 主要语言
- Swift
- 星标
- 720
- 派生
- 162
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
CodeEditApp/CodeEditSourceEditor 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 84/100
CodeEditApp/CodeEditSourceEditor#377 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 76/100
CodeEditApp/CodeEditSourceEditor#376 · 1 条评论 ·
-
难度 1/5 1-3 小时 新手友好度 68/100
-
难度 3/5 1-2 天 新手友好度 68/100
CodeEditApp/CodeEditSourceEditor#378 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 32/100
查看 CodeEditApp/CodeEditSourceEditor 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 88/100
manaflow-ai/cmux#13763 ·
-
type: feature request
难度 2/5 1-3 小时 新手友好度 82/100
googleapis/google-cloud-swift#1036 · 1 条评论 ·
-
难度 1/5 1 小时以内 新手友好度 78/100
wultra/mtoken-sdk-ios#253 ·
-
area:dictation documentation P2
难度 2/5 1-3 小时 新手友好度 78/100
uttrflow/uttrflow-swift#1180 ·
-
难度 2/5 1-3 小时 新手友好度 78/100