feat(libcairo): implement surface user-data ownership #16315
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/16315"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by ahmadmuj on 2026-11-06T07:18:24Z.
What
Implement
cairo_surface_set_user_dataso callers can attach cleanup to borrowed image buffers. Callbacks run after the final surface reference, including references held by subsurfaces.The behavior follows Cairo 1.18.0
src/cairo-surface.c:956-999,1161-1174andsrc/cairo-array.c:384-400,453-499. Callback types followsrc/cairo.h:232-257; parent release order followssrc/cairo-surface-subsurface.c:48-57. Official source, SHA-256243a0736b978a33dee29f9cca7521733b78a65b5418206fef7bd1c3d4cf10b64.Tested
Linux x86-64, Ubuntu 24.04 on WSL2, GCC 13.3. The new regression reaches main's real throwing stub, then passes with this change. Native Cairo 1.18.0 matches the shared callback, status, and allocation-failure scenarios. ASan/UBSan with leak detection pass. The full project build and all four Cairo CTest tests pass. Conventions passes on the actual commit.
The overlap tool exits 2 for shared files and stale branches. Manual comparison of exact heads for #14329, #15208, #15315, #15317, #15324, #15430, #15675, #15679, #15681, and #15685 finds distinct functions, exports, and tests. Shared debt counts and adjacent stubs can need later reconciliation.
Cases include key identity, replacement/removal, same-pointer replacement, null keys/callbacks, vacant slots, reverse destruction, borrowed pixels, extra references, subsurfaces, empty images, stored errors, teardown reentry, and first/growth allocation failures.
No Windows callback run, console measurement, or game-dump test. The console library revision remains unverified.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)