Skip to content

[Bug] MacOS 26.2 占用CPU 60%多, 应该是状态栏图标中文字的问题 #171

@yulong000

Description

@yulong000

从 macOS 26.1的测试版开始,Apple可能是更改了状态栏图标的绘制问题,导致状态栏上有显示文字的时候,会占用CPU 50%以上。

在我们自己的App上,验证过了,是NSTextField的问题。

只要状态栏图标上,使用了NSTextField组件去显示文字,就会导致死循环,不停的刷新图层绘制。

建议开发者可以排查一下,是否使用了NSTexField去显示文字(比如状态栏上的上传/下载)

解决办法是:

自定义文字显示组件,可以使用NSView,内部使用 draw(_ dirtyRec: NSRect) {} 自己绘制文字信息

string.draw(at, withAttributes)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions