Skip to content

Commit

Permalink
[Impeller] Do not capture the temporary ImpellerMapping struct pointe…
Browse files Browse the repository at this point in the history
…r when storing release callbacks in libImpeller

Fixes flutter/flutter#158285
  • Loading branch information
jason-simmons committed Nov 6, 2024
1 parent 571fac4 commit b715cf5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions impeller/toolkit/interop/impeller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -494,8 +494,9 @@ ImpellerTexture ImpellerTextureCreateWithContentsNew(
auto wrapped_contents = std::make_shared<fml::NonOwnedMapping>(
contents->data, // data ptr
contents->length, // data length
[contents, contents_on_release_user_data](auto, auto) {
contents->on_release(contents_on_release_user_data);
[on_release = contents->on_release, contents_on_release_user_data](
auto, auto) {
on_release(contents_on_release_user_data);
} // release callback
);
if (!texture->SetContents(std::move(wrapped_contents))) {
Expand Down Expand Up @@ -1147,8 +1148,9 @@ bool ImpellerTypographyContextRegisterFont(ImpellerTypographyContext context,
auto wrapped_contents = std::make_unique<fml::NonOwnedMapping>(
contents->data, // data ptr
contents->length, // data length
[contents, contents_on_release_user_data](auto, auto) {
contents->on_release(contents_on_release_user_data);
[on_release = contents->on_release, contents_on_release_user_data](auto,
auto) {
on_release(contents_on_release_user_data);
} // release callback
);
return GetPeer(context)->RegisterFont(std::move(wrapped_contents),
Expand Down

0 comments on commit b715cf5

Please sign in to comment.