Tiny fix for SVGKImage observer leak: "...instance of SVGKImage is being deallocated while key value observers are still registered..."

Open
#101 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
52/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
objective-c

Research direction

Open SVGKImage.m and inspect the dealloc function, especially the observer cleanup immediately before [super dealloc]. Confirm that the DomTree.viewport observer is removed there, then verify that the reported deallocation warnings or crashes no longer occur.

Written by the indexing model from the issue text.

Description

Hi guys,

Thanks for your wonderful work on SVGKit.

Here's a tiny fix:

Currently the SVGKImage doesn't remove it's observers during dealloc, which causes warnings, or crashes (under certain scenarios).

All that needs to be done to fix it is to add the following line in SVGKImage.m, in the dealloc function, right above [super dealloc];

[self removeObserver:self forKeyPath:@"DomTree.viewport" context:nil];

and that should solve the problem. Hope this helps someone.

Ivan.

Dominant language
Objective-C
Stars
4.6k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from SVGKit/SVGKit

All issues in SVGKit/SVGKit

Similar issues

More Objective-C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.