🐞 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
-
area:dictation documentation P2
難度 2/5 1-3 小時 新手友好度 78/100
uttrflow/uttrflow-swift#1180 ·
-
enhancement
難度 2/5 1-3 小時 新手友好度 68/100
-
type: docs
難度 1/5 1 小時以內 新手友好度 95/100
googleapis/google-cloud-swift#971 ·
-
難度 2/5 1-3 小時 新手友好度 76/100
bitcoindevkit/bdk-ffi#1125 ·
-
難度 2/5 1-3 小時 新手友好度 72/100
mozilla-mobile/firefox-ios#35743 ·