zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
50.24k stars 3.09k forks source link

gpui crashes when rendering coloured emoji #19687

Closed hamishneu closed 3 weeks ago

hamishneu commented 3 weeks ago

Check for existing issues

Describe the bug / provide steps to reproduce it

I can't get gpui to render any colour emoji without crashing immediately. At first I thought I was doing something wrong, but this occurs even in the opacity example, which renders coloured emoji:

https://github.com/zed-industries/zed/blob/03a1c8d2b8c1e1a623702b70796d1c5b1d265aff/crates/gpui/examples/opacity.rs#L148

Steps to reproduce:

git clone https://github.com/zed-industries/zed
cd zed/crates/gpui/
cargo run --example opacity

results in

zsh: bus error  cargo run --example opacity

if you remove the coloured emoji, the example works fine. only seems to occur with coloured emoji. strings like "☻" and "﷽" don't have this problem.

Here's a snippet from the macOS problem reporting utility that automatically pops up when the crash occurs:

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------
Process:               opacity [44805]
Path:                  /Users/USER/Desktop/*/opacity
Identifier:            opacity
Version:               ???
Code Type:             ARM-64 (Native)
Parent Process:        zsh [41996]
Responsible:           zed [41955]

Crashed Thread:        0  main  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGBUS)
Exception Codes:       UNKNOWN_0x101 at 0x000000000bad4007
Exception Codes:       0x0000000000000101, 0x000000000bad4007

Termination Reason:    Namespace SIGNAL, Code 10 Bus error: 10
Terminating Process:   exc handler [41898]

VM Region Info: 0xbad4007 is not in any region.  Bytes before following region: 4169924601
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      __TEXT                      104394000-104f44000    [ 11.7M] r-x/r-x SM=COW  /Users/USER/Desktop/*/opacity

Thread 0 Crashed:: main Dispatch queue: com.apple.main-thread
0   ???                                      0xbad4007 ???
1   ImageIO                                0x1a0cbc0c8 IIOReadPlugin::callInitialize() + 400
2   ImageIO                                0x1a0cbbe64 IIO_Reader::initImageAtOffset(CGImagePlugin*, unsigned long, unsigned long, unsigned long) + 164
3   ImageIO                                0x1a0cb94fc IIOImageSource::makeImagePlus(unsigned long, IIODictionary*) + 832
4   ImageIO                                0x1a0d30664 IIOImageSource::createImageAtIndex(unsigned long, IIODictionary*, int*) + 112
5   ImageIO                                0x1a0cc6004 CGImageSourceCreateImageAtIndex + 464
6   CoreText                               0x197d07718 CreateImageWithDataProvider(CGDataProvider*, unsigned int) + 208
7   CoreText                               0x197d02668 (anonymous namespace)::TCGImageData::TCGImageData(TFont const*, unsigned short, TsbixContext const&, double, CGPoint) + 1848

On an unrelated note, what you guys are doing with gpui is really cool. It would be great if it had it's own repo instead of being tucked away inside zed.

Environment

OS: macOS 15.0.1 Memory: 16 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

error

If applicable, attach your Zed.log file to this issue.

N/A, gpui issue not zed

hamishneu commented 3 weeks ago

a bit above my pay grade but it seems the issue is around here from testing https://github.com/zed-industries/zed/blob/03a1c8d2b8c1e1a623702b70796d1c5b1d265aff/crates/gpui/src/platform/mac/text_system.rs#L399-L427

hamishneu commented 3 weeks ago

nevermind, fixed seemed to be caused by local build issues with conflicting libraries installed via brew