Skip to content

Conversation

@subraatakumar
Copy link
Contributor

Prevent a dangling pointer by keeping the UTF‑8 string returned from JSI alive before calling c_str().

Root cause:
Code called arguments[1].asString(runtime).utf8(runtime).c_str() on a temporary; the temporary is destroyed at the end of the full-expression, producing a dangling pointer and triggering clang’s -Wdangling-assignment-gsl (failing Android native builds).

Change:
Store the UTF‑8 value in a local std::string and use childName = childNameStr.c_str() so the backing storage remains valid.

Files changed:

  • packages/skia/cpp/api/JsiSkImageFilterFactory.h

Testing / Verification:

  • Before: Android native build failed with -Wdangling-assignment-gsl pointing to JsiSkImageFilterFactory.h.
  • After: Rebuilt downstream app/native module; Android native build succeeds and clang no longer emits the dangling-assignment warning.
  • Reproduction: ./gradlew :app:assembleDebug in a project that builds this module.

Reviewer checklist:

  • Confirm the clang dangling-pointer diagnostic is gone.
  • Confirm no API or behavior changes beyond lifetime fix.
  • Run Android native build as a smoke test.

@subraatakumar
Copy link
Contributor Author

I have signed the CLA!

1 similar comment
@subraatakumar
Copy link
Contributor Author

I have signed the CLA!

@subraatakumar
Copy link
Contributor Author

Apologies — I closed the PR by mistake.
Thanks again for the review and approval. Happy to address any follow-ups if needed.

@subraatakumar subraatakumar reopened this Dec 17, 2025
@wcandillon wcandillon merged commit e9d10f3 into Shopify:main Dec 17, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants