Skip to content

Fix SKPaint.Clone - #2904

Merged
mattleibow merged 1 commit into
mono:mainfrom
jeremy-visionaid:skpaint_clone
Jul 8, 2024
Merged

mattleibow merged 1 commit into
mono:mainfrom
jeremy-visionaid:skpaint_clone

Conversation

@jeremy-visionaid

Copy link
Copy Markdown
Contributor

Clone should operate on SkCompatPaint

Description of Change

Fix crash on dispose of a cloned SKPaint

Bugs Fixed

API Changes

None.

Behavioral Changes

None.

Required skia PR

None.

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Rebased on top of main at time of PR
  • Merged related skia PRs
  • Changes adhere to coding standard
  • Updated documentation

Clone should operate on SkCompatPaint
@chersoft-oliverb

chersoft-oliverb commented Jul 8, 2024 •

Copy link
Copy Markdown

Hi @mattleibow could you cast an 👀 over this please?

We'd like to prep our codebase for 3.0 but this issue is a blocker at the moment.

Thanks!

@mattleibow mattleibow left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is exactly what should have been done.

The clone is not a normal function like the rest, it just instantiates a copy:

sk_paint_t* sk_paint_clone(sk_paint_t* paint) {
    return ToPaint(new SkPaint(*AsPaint(paint)));
}

Thanks!

@mattleibow
mattleibow merged commit 58b618c into mono:main Jul 8, 2024
mattleibow added a commit that referenced this pull request Jul 3, 2026
Expand the skill's scan taxonomy from 6 to 12 families, each backed by a
real historical SkiaSharp leak fix (finalizer/collection ordering #3796/#3291,
Clone double-free #2904, disposing native statics #1863/#4080/#1224,
field-not-nulled #1256/#1344, stream/callback/delegate-proxy lifetime
#3589/#2916/#996, allocation-failure #1784/#1642). Broaden Phase 1.3 de-dup to
search by api/type name (real leaks are filed as [BUG], not [memory-leak]) and
add the Blob.FromStream / PR #3473 worked example. Extend the Phase 3.2 fix
table to cover all 12 families. Document two verified, un-filed family-6
candidates surfaced by a model-diverse scan (SKRegion.SpanIterator missing
parent ref; SKPixmap.ExtractSubset/With* not propagating pixelSource).

Co-authored-by: Copilot App <[email protected]>
mattleibow added a commit that referenced this pull request Jul 3, 2026
Audit of all 11 families for over-specific/live targets that would let
the agent copy an answer instead of investigating:

- Family 4 (fixed-pointer): replace the "real, still-unfixed
  Blob.FromStream" worked example with a synthetic non-copying-native
  example; demote Blob.FromStream to a bare #3472/PR #3473 citation.
  Same for the SKILL.md cheat-sheet row 4.
- Family 3 (Views): drop the embedded live SKGLElement / open-PR #3311
  diagnosis from "Real cases"; keep the issue numbers only.
- Family 6 (clone double-free): genericize the SKPaint.Clone example to
  a neutral SKThing/sk_thing_clone wrapper; keep #2904 citation.

Remaining real symbols are all safe: documented same-instance contracts
(family 2), already-fixed issue citations, or correct reference
implementations to mirror (families 7-10). No un-fixed target is handed
to the agent as a worked answer.

Co-authored-by: Copilot App <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] (preview3.1) Access violation when a Cloned SKPaint is disposed/finalized

3 participants