Skip to content

Null out the field when disposing. - #1256

Merged
mattleibow merged 1 commit into
masterfrom
dev/fix-960
Apr 28, 2020
Merged

mattleibow merged 1 commit into
masterfrom
dev/fix-960

Conversation

@mattleibow

Copy link
Copy Markdown
Contributor

Description of Change

Null out the field when disposing.

Not sure why iOS is drawing a disposed object, but just be safe.

Bugs Fixed

API Changes

None.

Behavioral Changes

None visible... maybe fewer crashes?

PR Checklist

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

Not sure why iOS is drawing a disposed object, but just be safe.
@mattleibow mattleibow closed this Apr 28, 2020
@mattleibow mattleibow reopened this Apr 28, 2020
@mattleibow
mattleibow merged commit 221a96b into master Apr 28, 2020
@mattleibow
mattleibow deleted the dev/fix-960 branch April 28, 2020 15:44
@mattleibow mattleibow added this to the v1.68.2 milestone Apr 29, 2020
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 Sep 7, 2026
[memory-leak] Clarify disposed borrowed-field cleanup (#4994)

Context: #1256
Context: #1344
Context: https://github.com/mono/SkiaSharp/actions/runs/33936785050

Focus 8 previously treated a stale field only as an owned native-child
cleanup hazard. A disposed wrapper can also retain a caller-owned dependency:
the wrapper must not dispose that dependency, but retaining its field keeps the
caller object graph alive for as long as the disposed wrapper is reachable.

Teach the scanner to separate ownership from retention after wrapper/native
teardown. Keep fields rooted while native teardown or callbacks can use them;
then dispose owned resources before clearing their fields, and clear borrowed
resources without disposing them. Keep the example generalized so a matching
field shape alone does not diagnose sibling wrappers as defective.

The revised guidance was independently exercised by the focus-8 workflow run.
It produced a shipped-package WeakReference probe and an in-repository
red-to-green validation, without changing product behavior or public APIs.

Co-authored-by: v <[email protected]>
Co-authored-by: Matthew Leibowitz <[email protected]>
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] NullReferenceException occurs when iOS redraws SKCanvasView view but it had been already disposed

1 participant