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

[BUG] [CancellableNetworkTileProvider] Exception: Buffer parameter must not be null #1687

Closed
lonelyteapot opened this issue Oct 10, 2023 · 4 comments
Labels
bug This issue reports broken functionality or another error P: 1 (important)

Comments

@lonelyteapot
Copy link
Contributor

What is the bug?

I use CancellableNetworkTileProvider from the plugin. Frequently, when requests are cancelled, an unhandled Exception: Buffer parameter must not be null is shown in the console.

I haven't found where this exception comes from, but I think I've found the root cause:

_CNTPImageProvider uses an ImmutableBuffer that has been disposed:

https://github.com/fleaflet/flutter_map_cancellable_tile_provider/blob/dac6a1dddab0bdfda34049331ff6c2aee3379c64/lib/flutter_map_cancellable_tile_provider.dart#L147

Here, an ImmutableBuffer is created from TileProvider.transparentImage once, and then cached in tileProvider._cancelledImage for the whole lifetime of the TileProvider.

However, during the decode call, this buffer is disposed by sky_engine:

https://github.com/flutter/engine/blob/d379d53b8ab1f53244cce9fc6e9918bbdd18ecd6/lib/ui/painting.dart#L2317

How can we reproduce it?

https://github.com/fleaflet/flutter_map/blob/master/example/lib/pages/cancellable_tile_provider.dart

Do you have a potential solution?

Replacing ??= with ?? in the line linked above (therefore creating a new ImmutableBuffer on each cancelled request) seems to resolve the issue.

Platforms

Android 12 (Samsung Galaxy M21)

Severity

Minimum: Allows normal functioning

@lonelyteapot lonelyteapot added bug This issue reports broken functionality or another error needs triage This new bug report needs reproducing and prioritizing labels Oct 10, 2023
@JaffaKetchup
Copy link
Member

Thanks for reporting. I can't remember getting this issue myself, but I guess it makes sense that it would occur.

We'll look into this along with the other issues from v6.

@JaffaKetchup
Copy link
Member

Fixed in the latest 'main' on the plugin repo.

@tijee
Copy link

tijee commented Nov 24, 2023

Hi @JaffaKetchup thank you for the fix. Do you have an ETA for the next release?

@JaffaKetchup
Copy link
Member

We may be able to release a version for the plugin before the main repo. No planned date yet though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue reports broken functionality or another error P: 1 (important)
Projects
None yet
Development

No branches or pull requests

3 participants