Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory leak after rendering #3680

Merged
merged 3 commits into from
Oct 12, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Source/Charts/Utils/Platform+Accessibility.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ internal func accessibilityPostScreenChangedNotification(withElement element: An
/// A simple abstraction over UIAccessibilityElement and NSAccessibilityElement.
open class NSUIAccessibilityElement: UIAccessibilityElement
{
private let containerView: UIView
private weak var containerView: UIView?

final var isHeader: Bool = false
{
Expand Down Expand Up @@ -49,6 +49,7 @@ open class NSUIAccessibilityElement: UIAccessibilityElement

set
{
guard let containerView = containerView else { return }
super.accessibilityFrame = containerView.convert(newValue, to: UIScreen.main.coordinateSpace)
}
}
Expand Down Expand Up @@ -104,7 +105,7 @@ internal func accessibilityPostScreenChangedNotification(withElement element: An
/// A simple abstraction over UIAccessibilityElement and NSAccessibilityElement.
open class NSUIAccessibilityElement: NSAccessibilityElement
{
private let containerView: NSView
private weak var containerView: NSView?

final var isHeader: Bool = false
{
Expand Down Expand Up @@ -144,6 +145,8 @@ open class NSUIAccessibilityElement: NSAccessibilityElement

set
{
guard let containerView = containerView else { return }

let bounds = NSAccessibility.screenRect(fromView: containerView, rect: newValue)

// This works, but won't auto update if the window is resized or moved.
Expand Down