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

[flutter_svg] Bad state: A Dart object attempted to access a native peer, but the native peer has been collected (nullptr). This is usually the result of calling methods on a native-backed object when the native resources have already been disposed. #158814

Closed
stuartmorgan opened this issue Nov 13, 2024 · 2 comments
Labels
p: flutter_svg The Flutter SVG drawing packages package flutter/packages repository. See also p: labels.

Comments

@stuartmorgan
Copy link
Contributor

Imported from dnfield/flutter_svg#1062

Original report by @bojianyin on May 14, 2024

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Bad state: A Dart object attempted to access a native peer, but the native peer has been collected (nullptr). This is usually the result of calling methods on a native-backed object when the native resources have already been disposed.
E/flutter ( 7816): #0 StateError._throwNew (dart:core-patch/errors_patch.dart:135:5)
E/flutter ( 7816): #1 _NativeCanvas._drawImage (dart:ui/painting.dart)
E/flutter ( 7816): #2 _NativeCanvas.drawImage (dart:ui/painting.dart:6014:27)
E/flutter ( 7816): #3 SliderPainter._drawThumbNodes (package:lib_kit/widgets/slider/slider_painter.dart:73:12)
E/flutter ( 7816):

    SvgAssetLoader loader = SvgAssetLoader('images/svg/public_selected_square.svg',packageName: 'lib_resource');
    final PictureInfo pictureInfo = await vg.loadPicture(loader, null);
    // final PictureInfo pictureInfo = await vg.loadPicture(SvgStringLoader(rawSvg), null);
    ui.Image image = await pictureInfo.picture.toImage(20, 20);

    canvas.drawImage(image,Offset(0, 0),nodePaint);```

@stuartmorgan stuartmorgan added p: flutter_svg The Flutter SVG drawing packages package flutter/packages repository. See also p: labels. labels Nov 13, 2024
@jonahwilliams
Copy link
Member

Without a repro we have nothing to do here.

@jonahwilliams jonahwilliams closed this as not planned Won't fix, can't repro, duplicate, stale Nov 19, 2024
Copy link

github-actions bot commented Dec 3, 2024

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 Dec 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p: flutter_svg The Flutter SVG drawing packages package flutter/packages repository. See also p: labels.
Projects
None yet
Development

No branches or pull requests

2 participants