Skip to content

newCGContext returns RiveRendererContext instead of CGRendererContext since v6.9.4 #437

Description

@daichikuwa0618

Description

RenderContextManager.newCGContext returns RiveRendererContext (Metal-based) instead of CGRendererContext (CoreGraphics-based). This means setting defaultRenderer = .cgRenderer has no effect — the Metal renderer is always used.

Introduced in

Commit 7aa9afaf ("refactor(apple): use new render context per file and view (#9838)"), included in v6.9.4+.

Before this commit, there was a getCGRendererContext method that correctly returned the CG renderer. The refactoring replaced it with newCGContext, but the implementation was changed to return RiveRendererContext:

// RenderContextManager.mm line 432-435 (v6.15.1)
- (RenderContext*)newCGContext
{
    return [[RiveRendererContext alloc] init]; // ← should be CGRendererContext
}

Expected behavior

- (RenderContext*)newCGContext
{
    return [[CGRendererContext alloc] init];
}

Impact

  • RenderContextManager.shared().defaultRenderer = .cgRenderer does not switch to CoreGraphics
  • Users cannot fall back to CG renderer (e.g., for snapshot testing or CPU-only rendering environments)
  • The CGRendererContext class exists in the codebase but is unreachable

Context

We discovered this while investigating snapshot testing with swift-snapshot-testing. The default CALayer.render(in: CGContext) crashes (SIGBUS) on Metal-backed RiveView layers. We hoped to switch to CG renderer as a workaround, but found this bug.

Related: #263 (snapshot testing), #380 (try! in constructors)

Device & Versions

  • rive-ios: 6.15.1
  • Xcode: 26.3
  • iOS: any

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions