Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[web] svgClip "leak" in canvaskit renderer #82768

Closed
ditman opened this issue May 18, 2021 · 1 comment · Fixed by flutter/engine#26227
Closed

[web] svgClip "leak" in canvaskit renderer #82768

ditman opened this issue May 18, 2021 · 1 comment · Fixed by flutter/engine#26227
Assignees
Labels
e: web_canvaskit CanvasKit (a.k.a. Skia-on-WebGL) rendering backend for Web engine flutter/engine repository. See also e: labels. P1 High-priority issues at the top of the work list platform-web Web applications specifically

Comments

@ditman
Copy link
Member

ditman commented May 18, 2021

Steps to Reproduce

  1. Run the following app in canvaskit mode:
main.dart
import 'dart:html' as html;
import 'dart:ui' as ui;

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(
    MaterialApp(
      home: _App(),
    ),
  );
}

class _App extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body:
            _RotatingClipRRect(),
      );
  }
}

class _RotatingClipRRect extends StatefulWidget {
  @override
  _RotatingClipRRectState createState() => _RotatingClipRRectState();
}

class _RotatingClipRRectState extends State<_RotatingClipRRect> with TickerProviderStateMixin {
  late AnimationController _animationController;
  late Animation<double> _animation;

  @override
  void initState() {
    super.initState();
    _animationController = AnimationController(
      vsync: this,
      duration: const Duration(milliseconds: 5000),
      value: 0,
      lowerBound: 0,
      upperBound: 1,
    )..repeat();

    _animation = CurvedAnimation(
      parent: _animationController,
      curve: Curves.linear,
    );

    ui.platformViewRegistry.registerViewFactory(
      'test', (_) => html.DivElement()..style.background = '#fabada'
    );
  }

  @override
  Widget build(BuildContext context) {
    return Center(
        child: Container(
          child: RotationTransition(
            turns: _animation,
            child: SizedBox(
              width: 320,
              height: 200,
              child: ClipRRect(
                borderRadius: BorderRadius.circular(10.0),
                child: HtmlElementView(viewType: 'test',),
              ),
            ),
          ),
        ),
      );
  }

  @override
  void dispose() {
    _animationController.dispose();
    super.dispose();
  }
}
  1. In DevTools, locate the flt-clip tag that is being updated a lot. Close to it, there will be an svg tag with defs that gets a new element on every frame:
Screen.Recording.2021-05-17.at.4.48.22.PM.mov

Expected results: I'd expect the svg defs to stay contained (maybe not recreated?)

Actual results: A new svg def is being created per frame, and it never stops, until the browser starts to give up. This looks like a leak.

Logs
$ flutter doctor -v
[✓] Flutter (Channel master, 2.3.0-2.0.pre.42, on Linux, locale en_US.UTF-8)
    • Flutter version 2.3.0-2.0.pre.42 at /usr/local/google/home/dit/github/flutter
    • Upstream repository git@github.com:ditman/flutter.git
    • Framework revision 7f1d1414cc (13 days ago), 2021-05-04 06:17:19 -0700
    • Engine revision 378e4dbc41
    • Dart version 2.14.0 (build 2.14.0-48.0.dev)

@ditman ditman added engine flutter/engine repository. See also e: labels. platform-web Web applications specifically e: web_canvaskit CanvasKit (a.k.a. Skia-on-WebGL) rendering backend for Web P1 High-priority issues at the top of the work list labels May 18, 2021
@harryterkelsen harryterkelsen self-assigned this May 18, 2021
@kf6gpe kf6gpe added the cp: 2.2 label May 25, 2021
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
e: web_canvaskit CanvasKit (a.k.a. Skia-on-WebGL) rendering backend for Web engine flutter/engine repository. See also e: labels. P1 High-priority issues at the top of the work list platform-web Web applications specifically
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants