🐞 Segfault when using asset catalog colors
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 38/100
Hướng nghiên cứu
Bắt đầu với ContentView.swift trong EditorThemeReproduction.zip được liên kết và tái hiện segfault khi khởi chạy bằng các giá trị NSColor từ asset catalog, đặc biệt là NSColor.editorBackground. So sánh cách xây dựng EditorTheme bị lỗi với trường hợp usingColorSpace(.sRGB) hoạt động. Công việc được hoàn tất khi các màu từ asset catalog có thể định nghĩa một EditorTheme mà không cần chuyển đổi color-space tường minh và ứng dụng tái hiện khởi chạy mà không xảy ra segfault.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- Swift
- Star
- 720
- Fork
- 162
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của CodeEditApp/CodeEditSourceEditor
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
CodeEditApp/CodeEditSourceEditor#377 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
CodeEditApp/CodeEditSourceEditor#376 · 1 bình luận ·
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
CodeEditApp/CodeEditSourceEditor#378 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 32/100
Tất cả issue của CodeEditApp/CodeEditSourceEditor
Issue tương tự
-
The correction-threshold rationale says 17 restraint cases collide; the current corpus has 16 Đang mởarea:dictation documentation P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
uttrflow/uttrflow-swift#1180 ·
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
type: docs
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
googleapis/google-cloud-swift#971 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
bitcoindevkit/bdk-ffi#1125 ·
-
Move wallpaper setting Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
mozilla-mobile/firefox-ios#35743 ·