Skip to content

fix(ohos): release native image resources after processing - #163

Open
lirunquan wants to merge 1 commit into
fluttercandies:mainfrom
lirunquan:fix/ohos-image-resource-cleanup
Open

lirunquan wants to merge 1 commit into
fluttercandies:mainfrom
lirunquan:fix/ohos-image-resource-cleanup

Conversation

@lirunquan

Copy link
Copy Markdown

OpenHarmony image editing and merging can leave native image resources alive after processing. The packer is never explicitly released, and an exception can skip the release of the decoded image or its source.

Release the packer, pixel maps, and image sources after their last use, including temporary inputs used by mixing and merging. Await cleanup on success and failure. A cleanup error is logged so it cannot hide the original processing error or prevent subsequent cleanup.

Fixes #162.

Validation

  • Built a signed debug HAP with Flutter 3.41.10-ohos-1.0.1 and DevEco Studio, then installed and launched the example on a physical HarmonyOS device (API 26). Cropped a 1920 × 1920 image to 100 × 100 and resized it to 871 × 484 through the example UI. The device log confirmed both output sizes.
  • Ran 10 checks with mocked native APIs, including a case where encoding and resource release fail in the same call.

This validation did not include a sustained memory benchmark.

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.

[OpenHarmony] image_editor_ohos 0.0.9 misses ImagePacker.release()

1 participant