Skip to content

Canvas.moveTo + moveRelativeTo crashes #146362

@Albert221

Description

@Albert221

A simple Canvas.moveTo + moveRelativeTo crashes in my app. By crash, I mean the app exits and I'm back at home screen in the simulator. I managed to get a minimum reproducible example. I run Flutter 3.19.5 on macOS, I use iPhone SE (3rd gen) iOS 17.4 Simulator.

My observations:

  • paint is irrelevant
  • without initial moveTo it doesn't crash
  • the values in moveRelativeTo are important. It doesn't always crash
[✓] Flutter (Channel stable, 3.19.5, on macOS 14.1.1 23B81 darwin-arm64, locale en-PL)
    • Flutter version 3.19.5 on channel stable at /Users/albert/fvm/versions/3.19.5
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 300451adae (9 days ago), 2024-03-27 21:54:07 -0500
    • Engine revision e76c956498
    • Dart version 3.3.3
    • DevTools version 2.31.1

[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
    • Xcode at /Applications/Xcode-15.3.0.app/Contents/Developer
    • Build 15E204a
    • CocoaPods version 1.15.2

[✓] Connected device (4 available)
    • iPhone SE (3rd generation) (mobile) • 20FE85C5-72CD-4EC7-A5DB-1B9B467FF8AF • ios            • com.apple.CoreSimulator.SimRuntime.iOS-17-4 (simulator)
import 'package:flutter/material.dart';

void main() async {
  runApp(
    Center(
      child: CustomPaint(
        size: const Size(100, 100),
        painter: _Painter(),
      ),
    ),
  );
}

class _Painter extends CustomPainter {
  @override
  void paint(Canvas canvas, Size size) {
    final path = Path()
      ..moveTo(0, 0)
      ..relativeMoveTo(10, 10);

    canvas.drawPath(path, Paint());
  }

  @override
  bool shouldRepaint(_Painter oldDelegate) => false;
}

I don't get any crash log for this small example (maybe because it's right after launching the app?) but in the context of my real application I got a crash log below.

Metadata

Metadata

Assignees

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